Closed icedevml closed 4 months ago
@icedevml it's awesome, thanks for the contribution!
Could you please give an example of how to use restartTechnologyRequestIOS?
Whenever you have the transceive failure, you can call something like await NfcManager.setAlertMessageIOS("Failed to read the tag, please tap it again...")
in order to tell the user what is going on, then you can immediately call await NfcManager.restartTechnologyRequestIOS()
. The latter call will block until a new tag is detected, at which point you can use it normally with NfcManager.transceive(...)
.
In some cases we might get disconnected from the NFC tag. When that happens, we are not able to communicate with the NFC tag anymore, so on iOS the only valid further step is to invalidate NFC session with an error, and ask the user to try again. It also seems to be impossible to process multiple NFC tags within a single CoreNFC tag reading session (unless I'm mistaken).
This PR implements additional method called
restartTechnologyRequestIOS
which essentialy wires theNFCTagReaderSession.restartPolling()
into the react-native-nfc-manager. This API makes it possible to process multiple tags or to retry an NFC operation against the same tag in case of any failure, without actually restarting the NFC scanning prompt.