Post

Replies

Boosts

Views

Activity

About Background Tag Reading
Here is my write NDEF message code: let readerWriter = NFCReaderWriter.sharedInstance() let payloadData = NFCNDEFPayload(format: .nfcWellKnown, type: "U".data(using: .utf8)!, identifier: Data(), payload: "google.com".data(using: .utf8)!) let message = NFCNDEFMessage(records: [payloadData]) readerWriter.write(message, to: tags.first!) { (error) in if let err = error { print("ERR:\(err)") } else { print("write success") } self.readerWriter.end() } First Issue: When I want to read the NFC chip in the background without opening the app, I find the detection speed is not ideal. For example, this code writes "google.com" this time. When performing background reading, it does not successfully read every time the chip is near, and there seems to be a one-minute interval. Second Issue: When I implemented this method in the AppDelegate: - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { if (![userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { return NO; } NSLog(@"userActivity: %@", userActivity.ndefMessagePayload); if (userActivity.ndefMessagePayload) { return YES; } return NO; } I found that userActivity.ndefMessagePayload outputs null. At the same time, looking at its private variables, it seems to have values: Printing description of userActivity->_internal->_payloadDataCache: { "com.apple.corenfc.useractivity.ndefmessagepayload" = {length = 546, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 0000019c }; } If ndefMessagePayload is null, how can I determine that it is an NSUserActivity from an NFC scan?
2
0
385
Jun ’24
I got a crash log on iPad mini2 with os_unfair_lock_lock
I have an app which is Live on Appstore and has several daily active users. Recently a user reported consistent crash at random sports on her device. After communicating with the user, I got that the crash from her iPad mini 2 with iOS 12.4.8 and the stack trace has following information: log.ips After symbolicate the log: Thread 0 name: Dispatch queue: org.reactivecocoa.ReactiveObjC.RACScheduler.mainThreadScheduler Thread 0 Crashed: 0 libsystem_platform.dylib 0x0000000194547258 os_unfair_lock_lock$VARIANT$mp (in libsystem_platform.dylib) + 24 1 CoreFoundation 0x0000000194903190 __CFGetConverter (in CoreFoundation) + 92 2 CoreFoundation 0x0000000194902960 CFStringEncodingUnicodeToBytes (in CoreFoundation) + 180 3 CoreFoundation 0x0000000194905d78 __CFStringEncodeByteStream (in CoreFoundation) + 1604 4 Foundation 0x00000001952953d4 -[NSString(NSStringOtherEncodings) getBytes:maxLength:usedLength:encoding:options:range:remainingRange:] (in Foundation) + 248 5 CoreFoundation 0x000000019482de84 -[NSTaggedPointerString getBytes:maxLength:usedLength:encoding:options:range:remainingRange:] (in CoreFoundation) + 120 6 CoreFoundation 0x00000001948eb958 CFStringGetBytes (in CoreFoundation) + 144 7 Foundation 0x00000001954415ac _convertJSONString (in Foundation) + 416 8 Foundation 0x000000019544074c _writeJSONString (in Foundation) + 92 9 Foundation 0x00000001954418e0 ___writeJSONObject_block_invoke (in Foundation) + 80 10 libswiftCore.dylib 0x00000001c1f199f0 specialized _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:) (in libswiftCore.dylib) + 852 11 libswiftCore.dylib 0x00000001c1d6776c @objc _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:) (in libswiftCore.dylib) + 44 12 Foundation 0x0000000195440f20 _writeJSONObject (in Foundation) + 384 13 Foundation 0x0000000195441b84 ___writeJSONArray_block_invoke (in Foundation) + 156 14 CoreFoundation 0x0000000194919944 __NSArrayEnumerate (in CoreFoundation) + 412 15 Foundation 0x000000019544133c _writeJSONArray (in Foundation) + 288 16 Foundation 0x00000001952fd58c -[_NSJSONWriter dataWithRootObject:options:error:] (in Foundation) + 140 17 Foundation 0x00000001952fd2b4 +[NSJSONSerialization dataWithJSONObject:options:error:] (in Foundation) + 356 18 ??? 0x00000001035737b8 static Mapper.toJSONData(_:options:) (in --) (Mapper.swift:388) 19 ??? 0x00000001035736a4 static Mapper.toJSONString(_:prettyPrint:) (in --) (&lt;compiler-generated&gt;:0) 20 ??? 0x0000000103570e38 Mapper.toJSONString(_:prettyPrint:) (in --) (Mapper.swift:370) 21 ??? 0x000000010356eb94 Array&lt;A&gt;.toJSONString(prettyPrint:) (in --) (Mappable.swift:104) The logic is to dump an array to a file. Can anyone suggest what could be the possible issue here?
3
0
1.6k
Sep ’21