Calling NFC Reader in a different ViewController

Hello,

im trying to call from my View Controller a NFC Reader in a different ViewController. The NFC Reader starts but doesn't calls:

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs...)

I can call the NFC Reader in the other ViewController but don't use reader output because i think, that he doesn't calls the didDetectNDEF function.

Thanks for Help

Replies

i'm trying to call from my View Controller a NFC Reader in a different ViewController.

What do you do exactly ? Are you sure the second controller is already loaded when you call ?

If both ViewControllers are loaded did you try to push notification or use delegation ?

  • I´m calling the readNFC function which is in ViewControllerB from MainController. The readNFC function normally calls function didDetectNDEFs or didInvalidateWithError. I have in both functions a print("...") but I don't get it printed into the Terminal/ Console. Because of that, I think that the readNFC function doesn't calls the other.

Add a Comment

Show the code of both controllers.

It is important to check how you call.

What is the sequence of events ? Is it this one ?

  • launch Main controller
  • call readNFC
  • segue or load ViewControllerB

Please explain more.