NFC background reading crashs ipod touch

Hi,


i added some NFC background reading to my app. But when I try to deploy the app on the ipod touch it crashs directly. On the iPad and Simulator it works without problems, all the dont have NFC. I tried to add the canImport(CoreNFC) stuff, and also the "do not embed" CoreNFC.

It crashs with this message:

dyld: Library not loaded: /System/Library/Frameworks/CoreNFC.framework/CoreNFC

Referenced from: /private/var/containers/Bundle/Application/4BD57EFD-C373-4B2E-993B-663A142995AA/nfcTest.app/nfcTest

Reason: image not found

Message from debugger: Terminated due to signal 6


As soon as I have this function in my app delegate it stops working. Even its never called.

    #if canImport(CoreNFC)
        func application(_ application: UIApplication,
                         continue userActivity: NSUserActivity,
                         restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
       
           
            guard userActivity.activityType == NSUserActivityTypeBrowsingWeb else {
                return false
            }
            // Confirm that the NSUserActivity object contains a valid NDEF message.
            let ndefMesage = userActivity.ndefMessagePayload
            return true
           
           
        }
        #endif


Xcode: 11.4

iOS 13.4



Any ideas?

Replies

Have you done the same for imports where you use CoreNFC?


#if canImport(CoreNFC)
import CoreNFC
#endif