Closed dewald-els closed 4 years ago
I also receive this error when using addTagDiscoveredListener
for iOS. From the CoreNFC documentation provided by apple:
NFCTagReaderSession
A reader session for detecting ISO7816, ISO15693, FeliCa, and MIFARE tags.
and
NFCVASReaderSession
A reader session for processing Value Added Service (VAS) tags.
are still in Beta and will be available within iOS 13. So the solution is wait for iOS 13 release and then some good soul to add support for addTagDiscoveredListener
for iOS.
EDIT:
Otherwise if you want to listen only NDEF tags to iOS I do use the following code with @ionic-native/nfc
and it works perfectly.
import { NFC } from '@ionic-native/nfc';
...
constructor(private nfc: NFC) {...}
...
enableNFC(): void {
this.nfc.enabled().then(() => {
this.subscribers.nfcSession = this.nfc.beginSession().subscribe(() => {
this.subscribers.addListener = this.nfc.addTagDiscoveredListener(() => {}).subscribe((event: any) => {
alert(this.nfc.bytesToString(event.tag.ndefMessage[0].payload))
this.subscribers.nfcSession.unsubscribe();
this.subscribers.addListener.unsubscribe();
});
});
}, () => {
alert('NFC NOT ALLOWED');
});
}
iOS works in v1.1.0. addTagDiscoveredListener is not supported on iOS.
I've been trying to get this working on iOS with no luck. I call the beginSession() function before attempting to start the scan.
The console throws out the following error:
Here is a sample of the code:
Any help would be greatly appreciated!