I get this error and app get crash while run CoreNFC sample
code in Xcode 9.0 beta 2
dyld: Library not loaded: @rpath/CoreNFC.framework/CoreNFC
Referenced from: /var/containers/Bundle/Application/2837709C-C852-4811-B696-38F2725554D4/iOS-11-by-Examples.app/iOS-11-by-Examples
Reason: image not found
Does anyone knows how to fix this?
CoreNFC is only available on iPhone 7 and iPhone 7 Plus devices. Make sure you're running your code on one of those.
See the WWDC session and the relevant documentation for more information.
https://developer.apple.com/videos/play/wwdc2017/718/
https://developer.apple.com/documentation/corenfc
I combined some answers together to fix this thanks to @Chinchan Zu's comment
First you make import to NFCCore in "Linked Frameworks and Libraries" as optional as in this screenshot
Then inside your code you wrap your code with this #if check. Here is the class I used