1:证书的配置文件中,打开 NFC Tag Reading.
2: 导入 CoreNFC.framework
3:进入 TAGER - Capabilities-
4: 进入plist 文件夹
5: 导入 :#import<CoreNFC/CoreNFC.h>
设置<NFCNDEFReaderSessionDelegate>
- (void)viewDidLoad {
[super viewDidLoad];
NFCNDEFReaderSession *session = [[NFCNDEFReaderSession alloc] initWithDelegate:self queue:dispatch_queue_create(NULL, DISPATCH_QUEUE_CONCURRENT) invalidateAfterFirstRead:YES];
[sessionbeginSession];
// Do any additional setup after loading the view, typically from a nib.
}
- (void) readerSession:(nonnullNFCNDEFReaderSession*)session didDetectNDEFs:(nonnullNSArray *)messages {
for(NFCNDEFMessage*messageinmessages) {
for(NFCNDEFPayload*payloadinmessage.records) {
NSLog(@"Payload data1:%@",payload.payload);
}
}
}