Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

NFC write to ISO 15693

HI,

iOS13 will open up CoreNFC for third party. WIll it be possible to write to NFC-devices with ISO 15693? Like EEPROMs?
Curretnly we are working with Xamarin.Forms and use some devices with such an EEPROM.
Until now we can write to these devices from Android only. We want to update our application for iOS if this will be possible in the future.
Does anyone know about it?

On GitHub I found some write methods:

    [iOS (13,0)]

if XAMCORE_4_0

    [Abstract]

endif

    [Export ("writeSingleBlockWithRequestFlags:blockNumber:dataBlock:completionHandler:")]
    void WriteSingleBlock (RequestFlag flags, byte blockNumber, NSData dataBlock, Action<NSError> completionHandler);

Has anyone played around with this new feature?

thanks

Best regards
Markus

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I @MarkusBittner . I don't know about "writing", but have you been able to read NFC Tag with xamarin ios? I am not been able, I have always a 202 error...

  • MarkusBittnerMarkusBittner USMember ✭✭

    HI @AlessandroCaliaro .

    ;-) I tried the sample for Reading a NFC Tag on Xamarin.iOS and got the same error. Tried to change the Linking. This solved the Error 202 but still not working for me. I'm missing something.

    With Linking set to "none" i get the error , that the linked library passed away

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Thanks @MarkusBittner for your fast response:
    1- what does it mean "but still not working for me"? Have you other errors or simply "it reads nothing"?
    2- how do you set the link: Don't link, link frameworks only or link all?

    Thanks again

  • MarkusBittnerMarkusBittner USMember ✭✭

    1- i got a new error. My App is crashing if i put my smartphone above our NFC-Tag.
    I will link the error later in this Comment. Currently I'm working on an other project.

    1. I set the Link to "Don't link". After that the error 202 was gone.

    I will come back to you asap with the full error message on my Debugger.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
  • MarkusBittnerMarkusBittner USMember ✭✭

    Hi @AlessandroCaliaro:

    Here is my current error message:
    System.Exception
    Nachricht = Could not initialize an instance of the type 'CoreNFC.NFCNdefReaderSession': the native 'initWithDelegate:queue:invalidateAfterFirstRead:' method returned nil.
    It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

    i tried to ignore this error by using:

    public void Begin_NFC_Session() { Session = new NFCNdefReaderSession(this, null, true); if (Session != null) { ObjCRuntime.Class.ThrowOnInitFailure = false; Session.BeginSession(); <= Here it is throwing the error } }

    I don't know if the layout in the example needs som images or something.
    https://docs.microsoft.com/de-de/xamarin/ios/platform/introduction-to-ios11/corenfc

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Yes @MarkusSchiller I have received the same error and correct it setting ThrowOnInitFailure to false. Now it seems I have solved my problems.. I have copied the source code to a MAC and I use VS4MAC and it works fine, I can read tags. I don't understand why the same code does not work in VS2019 (windows)… I have to investigate

  • ThomPThomP Member

    Is there any way to find out if or when the new CoreNFC functionalities will be part of the official API/Documentation?

  • WimDeVriendtWimDeVriendt BEMember ✭✭
    edited March 2020

    Hi anybody implemented WriteSingleBlock to write to nfc chip ISO 15693?
    can you pls share xamarin.ios code ?

  • WimDeVriendtWimDeVriendt BEMember ✭✭

    Hi is there a sample available ?

Sign In or Register to comment.