.. _NFC: NCF communication ================= On iOS, NFC operations are restricted by the system. They can only be performed after a system call when a pop-up displayed on the screen. That is why specific API functions must be used to read tokens with NFC. Using NFC readers on iOS ------------------------ Note that iOS NFC Tag Reader Session is supported in: iPhone XR, iPhone X, iPhone XS, iPhone XS Max, iPhone 11, iPhone 11 Pro. (iOS 13) If the creation of the environment was successful (:js:class:`SCWS.create`) and the device supports NFC Tag Reader Session, a :js:class:`Reader` named ``NFC Interface`` will be added to the list of the readers (:js:class:`SCWS.readers`). To get the NFC (:js:class:`Reader`), call (:js:class:`SCWS.getReader`) by passing ``NFC Interface`` as parameter. For (:js:class:`Reader`) objects with :js:class:`Reader.requiresNfcTagReaderSession` returns ``true``, you must use the functions below. To start scanning for NFC Tags, call (:js:class:`SCWS.initNfcTagReaderSession`). iOS will display an alert action sheet waiting to detect tags. When a tag is detected, your app will receive a (:js:class:`SCWS.onreaderstatechanged`) event. When your app is done communicating with the card or if an error occurred, call (:js:class:`SCWS.endNfcTagReaderSession`). It will end the NFC Tag Reader Session, dismiss the alert action sheet and display a message error or a positive check mark to the user. .. js:autofunction:: SCWS.initNfcTagReaderSession .. js:autofunction:: SCWS.endNfcTagReaderSession .. js:autofunction:: SCWS.updateMessageNfcTagReaderSession Similar behavior on Android --------------------------- In order to have cross-platform code, a similar behavior can be achieved with the (:js:class:`AndroidNfcOverlay`) class. For example code to implement cross-platform NFC reading code, see :ref:`nfcexample`.