CoreNFC tutorial

Well, when Apple presented iBeacon during the WWDC 2013, I bet that one year later they would have presented the NFC support. But it’s well known that I’m a terrible punter and Apple has finally introduce the support to NFC this year.

This means that starting from iOS 11 (and on iPhone 7/iPhone7+ and future deveices) our apps can leverage on NFC tags to get contextual info about the physical world around the user (especially for location aware apps, physical marketing campaigns, ..).

As described in the documentation:

Using Core NFC, you can read Near Field Communication (NFC) tags of types 1 through 5 that contain data in the NFC Data Exchange Format (NDEF)

So this means that so far it’s not possible to write NFC tags or card emulation.

NDEF

NDEF (NFC Data Exchange Format) is a protocol provided by the NFC Forum which is used to describe how a NFC tag must expose data. Every NDEF record is made up by two components:

  1. A record type (check out this doc)
  2. Payload data

Once a device (i.e. an iPhone or an Apple Watch) is ready to read data from a NFC tag and it’s placed near the tag, these components are exchanged between the NFC tag and the reader.

CoreNFC is able to interact with NFC tags 1/2/3/4 and 5.

Unfortunately this format is not fully supported because it seems that records like Mime type or URI are not included in the framework (or maybe we have to create custom classes to support them? 🤔)

Continue Reading