NFC Reading on iOS 11 in 4 easy steps

Antoine Barrault
Jun 8, 2017 · 2 min read

With the launch of iOS 11 Apple start open us the use of the NFC on iOS. For the moment it is only possible to read content.

iOS new features with NFC reader mode

1) Enable NFC Tag Reading capability

For the moment you need to go the Certificates, Identifiers & Profiles page (https://developer.apple.com/account/ios/identifier/bundle) to add manually the NFC capability to your app.

NFC tag reading capability on Dev center

And add this to the entitlments of your app:

In a next Xcode version, Apple will include directly inside your the capabilities tab on your Xcode project.

2) Add NFC usage description to your project.

As you do for location usage descriptions or photo access, you need to add a string that describe the usage that your app will do with the NFC this description string will be showed to the user.
So add a string for the key: “Privacy — NFC Scan Usage Description” to your Info.plist.

Privacy — NFC Scan Usage Description” in Info.plist

3) Implement NFCNDEFReaderSessionDelegate

You can copy this extension and paste it into your code just remember to update it with your class name.

4) Start Scanning


Wrapping all together

I wrote this simple class to wrap all logic inside on class that you can easily incorporate into your app, I called it NFCScanner.

To call the scanner inside your app just do something like this:

That’s it! Now you can read NFC Tags with iOS. Note that there are some limitations: the scan session it is limited to 60 seconds and only runs in the foreground.

Troubleshooting: CoreNFC only works on iPhone 7 and iPhone 7 Plus and if you try to build against an iPhone Simulator, the CoreNFC framework will not be found.

You can find the example project here: https://github.com/barrault01/nfc_example

Antoine Barrault

Written by

I write Swift code. Dad of two awesome children with a wonderful wife. Currently Head of Mobile @ Guru Investimentos

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade