Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for iOS 16.4 #486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/ios/NfcPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// (c) 2107-2020 Don Coleman

#import "NfcPlugin.h"
#import <CoreNFC/CoreNFC.h>

@interface NfcPlugin() {
NSString* sessionCallbackId;
Expand Down Expand Up @@ -124,14 +125,13 @@ - (void)writeTag:(CDVInvokedUrlCommand*)command API_AVAILABLE(ios(13.0)){
} else { // create a new session
if (self.shouldUseTagReaderSession) {
NSLog(@"Using NFCTagReaderSession");

self.nfcSession = [[NFCTagReaderSession new]
initWithPollingOption:(NFCPollingISO14443 | NFCPollingISO15693)
delegate:self queue:dispatch_get_main_queue()];
self.nfcSession = [[NFCTagReaderSession alloc] initWithPollingOption: (NFCPollingISO14443 | NFCPollingISO15693)
delegate: self
queue: dispatch_get_main_queue()];

} else {
NSLog(@"Using NFCTagReaderSession");
self.nfcSession = [[NFCNDEFReaderSession new]initWithDelegate:self queue:nil invalidateAfterFirstRead:FALSE];
self.nfcSession = [[NFCNDEFReaderSession alloc] initWithDelegate:self queue:nil invalidateAfterFirstRead:FALSE];
}
}

Expand Down Expand Up @@ -306,20 +306,20 @@ - (void)startScanSession:(CDVInvokedUrlCommand*)command {

if (self.shouldUseTagReaderSession) {
NSLog(@"Using NFCTagReaderSession");
self.nfcSession = [[NFCTagReaderSession new]
self.nfcSession = [[NFCTagReaderSession alloc]
initWithPollingOption:(NFCPollingISO14443 | NFCPollingISO15693)
delegate:self queue:dispatch_get_main_queue()];
} else {
NSLog(@"Using NFCNDEFReaderSession");
self.nfcSession = [[NFCNDEFReaderSession new]initWithDelegate:self queue:nil invalidateAfterFirstRead:TRUE];
self.nfcSession = [[NFCNDEFReaderSession alloc]initWithDelegate:self queue:nil invalidateAfterFirstRead:TRUE];
}
sessionCallbackId = [command.callbackId copy];
self.nfcSession.alertMessage = @"Hold near NFC tag to scan.";
[self.nfcSession beginSession];

} else if (@available(iOS 11.0, *)) {
NSLog(@"iOS < 13, using NFCNDEFReaderSession");
self.nfcSession = [[NFCNDEFReaderSession new]initWithDelegate:self queue:nil invalidateAfterFirstRead:TRUE];
self.nfcSession = [[NFCNDEFReaderSession alloc]initWithDelegate:self queue:nil invalidateAfterFirstRead:TRUE];
sessionCallbackId = [command.callbackId copy];
self.nfcSession.alertMessage = @"Hold near NFC tag to scan.";
[self.nfcSession beginSession];
Expand Down