Skip to content

Commit 2e96eca

Browse files
committed
compatibility with IOS 14.X and newer
close chariotsolutions#452
1 parent d325b86 commit 2e96eca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ios/NfcPlugin.m

+5-5
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ - (void)writeTag:(CDVInvokedUrlCommand*)command API_AVAILABLE(ios(13.0)){
125125
if (self.shouldUseTagReaderSession) {
126126
NSLog(@"Using NFCTagReaderSession");
127127

128-
self.nfcSession = [[NFCTagReaderSession new]
128+
self.nfcSession = [[NFCTagReaderSession alloc]
129129
initWithPollingOption:(NFCPollingISO14443 | NFCPollingISO15693)
130130
delegate:self queue:dispatch_get_main_queue()];
131131

132132
} else {
133133
NSLog(@"Using NFCTagReaderSession");
134-
self.nfcSession = [[NFCNDEFReaderSession new]initWithDelegate:self queue:nil invalidateAfterFirstRead:FALSE];
134+
self.nfcSession = [[NFCNDEFReaderSession alloc]initWithDelegate:self queue:nil invalidateAfterFirstRead:FALSE];
135135
}
136136
}
137137

@@ -306,20 +306,20 @@ - (void)startScanSession:(CDVInvokedUrlCommand*)command {
306306

307307
if (self.shouldUseTagReaderSession) {
308308
NSLog(@"Using NFCTagReaderSession");
309-
self.nfcSession = [[NFCTagReaderSession new]
309+
self.nfcSession = [[NFCTagReaderSession alloc]
310310
initWithPollingOption:(NFCPollingISO14443 | NFCPollingISO15693)
311311
delegate:self queue:dispatch_get_main_queue()];
312312
} else {
313313
NSLog(@"Using NFCNDEFReaderSession");
314-
self.nfcSession = [[NFCNDEFReaderSession new]initWithDelegate:self queue:nil invalidateAfterFirstRead:TRUE];
314+
self.nfcSession = [[NFCNDEFReaderSession alloc]initWithDelegate:self queue:nil invalidateAfterFirstRead:TRUE];
315315
}
316316
sessionCallbackId = [command.callbackId copy];
317317
self.nfcSession.alertMessage = @"Hold near NFC tag to scan.";
318318
[self.nfcSession beginSession];
319319

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

0 commit comments

Comments
 (0)