Search code examples
iosiphonenfcios11core-nfc

iOS 11 CoreNFC How To Check if device has NFC Capability?


How does one detect if an iPhone has the ability to use the NFC chip provided by the core NFC framework?

I know right now it only works on iPhone 7 and 7 plus but I don't want to hardcode hardware string identifiers as I don't know what devices will come out in the future.


Solution

  • You can use the readingAvailable class property:

    if NFCNDEFReaderSession.readingAvailable {
        // Set up the NFC session
    } else {
        // Provide fallback option
    }