CoreNFC problem

Hi everyone,


I'm testing CoreNFC in an app.

I use iPhone7, iOS 11 and Xcode 9

The app is that when I read NFC tag, webpage appear.

when I run this app, one error appear in the log:


readerSession(_:didInvalidateWithError:) Error Domain=NFCError Code=204 "Single tag read" UserInfo={NSLocalizedDescription=Single tag read}


What happend?

Old thread, but want to answer for future reference.


To read something with CoreNFC, you start a session, once a tag is successfully read, the user cancels the reading or the session times out after 60 seconds, the session invalidates.

Invalidating the session calls the method readerSession(_:didInvalidateWithError:) ... that's it.


So to answer the question "What happened?", the answer is that the CoreNFC session successfully read one tag, and invalidated after that, this is the correct behaviour ... in Apple's opinion.

In my opinion, "Single tag read" is NOT an error, thus should not be in an error (core 204), but rather as an "info", or should be calling a completely different function.

We generally use the error/failure function to log an error, modify the user's interface or inform the user of the error. It's not a good design to compare error codes to know if it's an error or a correct beehaviour.

CoreNFC problem
 
 
Q