我正在尝试通过CoreNFC框架读取NFC标签,但遇到错误。 已经尝试使用以下代码
任何帮助,我们将不胜感激。 预先感谢。
Started scanning for tags
2019-12-30 17:35:33.709179+0530 nfcTest[2492:251252] [xpc.exceptions] <NSXPCConnection: 0x281c92e20> connection to service on pid 82 named com.apple.nfcd.service.corenfc: Exception caught during decoding of received selector didDetectExternalReaderWithNotification:, dropping incoming message.
Exception: Exception while decoding argument 0 (#2 of invocation):
Exception: decodeObjectForKey: class "NFFieldNotification" not loaded or does not exist
(
0 CoreFoundation 0x000000018c7e5820 FF63481D-FB6A-353B-B2C1-AC4EAECF594D + 1226784
1 libobjc.A.dylib 0x000000018c50dfa4 objc_exception_throw + 56
2 Foundation 0x000000018ccd1390 3C682044-3249-3938-8111-F2F12D066D2B + 2339728
3 Foundation 0x000000018caaa4e4 3C682044-3249-3938-8111-F2F12D066D2B + 83172
4 Foundation 0x000000018ccf35dc 3C682044-3249-3938-8111-F2F12D066D2B + 2479580
5 Foundation 0x000000018caff62c 3C682044-3249-3938-8111-F2F12D066D2B + 431660
6 Foundation 0x000000018caff994 3C682044-3249-3938-8111-F2F12D066D2B + 432532
7 Foundation 0x000000018cae9d70 3C682044-3249-3938-8111-F2F12D066D2B + 343408
8 Foundation 0x000000018cccf1bc 3C682044-3249-3938-8111-F2F12D066D2B + 2331068
9 libxpc.dylib 0x000000018c3b3448 219DEC3C-E62E-395D-8911-FB74F73A5598 + 50248
10 libxpc.dylib 0x000000018c3b37c0 219DEC3C-E62E-395D-8911-FB74F73A5598 + 51136
11 libdispatch.dylib 0x0000000100d4ec98 _dispatch_client_callout4 + 16
12 libdispatch.dylib 0x0000000100d68aa8 _dispatch_mach_msg_invoke + 420
13 libdispatch.dylib 0x0000000100d55990 _dispatch_lane_serial_drain + 304
14 libdispatch.dylib 0x0000000100d698f8 _dispatch_mach_invoke + 520
15 libdispatch.dylib 0x0000000100d55990 _dispatch_lane_serial_drain + 304
16 libdispatch.dylib 0x0000000100d56718 _dispatch_lane_invoke + 500
17 libdispatch.dylib 0x0000000100d61adc _dispatch_workloop_worker_thread + 1324
18 libsystem_pthread.dylib 0x000000018c502f88 _pthread_wqthread + 276
19 libsystem_pthread.dylib 0x000000018c505ad4 start_wqthread + 8
)
(
0 CoreFoundation 0x000000018c7e5820 FF63481D-FB6A-353B-B2C1-AC4EAECF594D + 1226784
1 libobjc.A.dylib 0x000000018c50dfa4 objc_exception_throw + 56
2 Foundation 0x000000018ccf3828 3C682044-3249-3938-8111-F2F12D066D2B + 2480168
3 Foundation 0x000000018caff62c 3C682044-3249-3938-8111-F2F12D066D2B + 431660
4 Foundation 0x000000018caff994 3C682044-3249-3938-8111-F2F12D066D2B + 432532
5 Foundation 0x000000018cae9d70 3C682044-3249-3938-8111-F2F12D066D2B + 343408
6 Foundation 0x000000018cccf1bc 3C682044-3249-3938-8111-F2F12D066D2B + 2331068
7 libxpc.dylib 0x000000018c3b3448 219DEC3C-E62E-395D-8911-FB74F73A5598 + 50248
8 libxpc.dylib 0x000000018c3b37c0 219DEC3C-E62E-395D-8911-FB74F73A5598 + 51136
9 libdispatch.dylib 0x0000000100d4ec98 _dispatch_client_callout4 + 16
10 libdispatch.dylib 0x0000000100d68aa8 _dispatch_mach_msg_invoke + 420
11 libdispatch.dylib 0x0000000100d55990 _dispatch_lane_serial_drain + 304
12 libdispatch.dylib 0x0000000100d698f8 _dispatch_mach_invoke + 520
13 libdispatch.dylib 0x0000000100d55990 _dispatch_lane_serial_drain + 304
14 libdispatch.dylib 0x0000000100d56718 _dispatch_lane_invoke + 500
15 libdispatch.dylib 0x0000000100d61adc _dispatch_workloop_worker_thread + 1324
16 libsystem_pthread.dylib 0x000000018c502f88 _pthread_wqthread + 276
17 libsystem_pthread.dylib 0x000000018c505ad4 start_wqthread + 8
)
Session did invalidate with error: Error Domain=NFCError Code=202 "Session invalidated unexpectedly" UserInfo={NSLocalizedDescription=Session invalidated unexpectedly}
答案 0 :(得分:0)
您是否已在plist文件中授予权限?
隐私-NFC扫描使用说明