I'm trying to implement a simple app in Swift 4 with CoreNFC to explore the framework, but I can't get it to work on my iPhone 7.
My code is very straightforward:
nfcSession = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: false) nfcSession?.begin() print("NFC Ready: \(nfcSession.isReady)")
And I always get the output:
NFC Ready: false
And then
func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error)
is called with the following error:
Error Domain=NFCError Code=202 "Session is invalidated unexpectedly" UserInfo={NSLocalizedDescription=Session is invalidated unexpectedly}
It doesn't matter when I call the functions, it always fails.
Does anyone have the same problem? Did you manage to solve it? Thanks!