From 1ff115b6d7668a997d8ada2548eac1ba520580ed Mon Sep 17 00:00:00 2001 From: Srinidhi Date: Thu, 13 Apr 2023 11:47:30 +0530 Subject: [PATCH] Update NfcPlugin.m FIxed the code to make it compatible with latest changes in iOS 16.4. --- src/ios/NfcPlugin.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ios/NfcPlugin.m b/src/ios/NfcPlugin.m index 9b40f251..00fa3a91 100644 --- a/src/ios/NfcPlugin.m +++ b/src/ios/NfcPlugin.m @@ -5,6 +5,7 @@ // (c) 2107-2020 Don Coleman #import "NfcPlugin.h" +#import @interface NfcPlugin() { NSString* sessionCallbackId; @@ -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]; } } @@ -306,12 +306,12 @@ - (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."; @@ -319,7 +319,7 @@ - (void)startScanSession:(CDVInvokedUrlCommand*)command { } 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];