Framework

Core NFC

Detect NFC tags, read messages that contain NDEF data, and save data to writable tags.

Overview

Your app can read tags to give users more information about their physical environment and the real-world objects in it. 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). For example, your app might give users information about products they find in a store or exhibits they visit in a museum.

Your app can also write data to tags, and interact with protocol specific tag such as ISO 7816, ISO 15693, FeliCa™, and MIFARE® tags.

Core NFC is not available for use in app extensions, and it requires a device that supports Near Field Communication. To determine if support is available, check the readingAvailable class property before starting a reader session.

Topics

Essentials

Building an NFC Tag-Reader App

Read NFC tags with NDEF messages in your app.

Adding Support for Background Tag Reading

Allow users to scan NFC tags without an app using background tag reading.

property list key NFCReaderUsageDescription

A message that tells the user why the app is requesting access to the device’s NFC hardware.

Name: Privacy - NFC Scan Usage Description

Reader Sessions

Create a reader session to scan and detect NFC tags.

class NFCNDEFReaderSession

A reader session for detecting NFC Data Exchange Format (NDEF) tags.

class NFCTagReaderSession

A reader session for detecting ISO7816, ISO15693, FeliCa, and MIFARE tags.

class NFCVASReaderSession

A reader session for processing Value Added Service (VAS) tags.

class NFCReaderSession

The abstract base class that represents a reader session for detecting NFC tags.

protocol NFCReaderSessionProtocol

A general interface for interacting with a reader session.

Near Field Communication Tag Reader Session Formats Entitlement

The Near Field Communication data formats the app is allowed to read.

Key: com.apple.developer.nfc.readersession.formats

Tag Types

Read tag data, and save data to writable tags, by using the appropriate tag type interface.

Creating NFC Tags from Your iPhone

Save data to tags, and interact with them using native tag protocols.

protocol NFCISO7816Tag

An interface for interacting with an ISO 7816 tag.

protocol NFCISO15693Tag

An interface for interacting with an ISO 15693 tag.

protocol NFCFeliCaTag

An interface for interacting with a FeliCa™ tag.

protocol NFCMiFareTag

An interface for interacting with a MIFARE® tag.

protocol NFCNDEFTag

An interface for interacting with an NDEF tag.

enum NFCTag

An object that represents an NFC tag object.

class NFCTagCommandConfiguration

A set of parameters you use to define the configuration of an NFC tag command.

NDEF Messages and Payloads

class NFCNDEFMessage

An NFC NDEF message consisting of an array of payload records.

class NFCNDEFPayload

A payload record in an NFC NDEF message.

Errors

struct NFCReaderError

An error type that indicates problems with reader sessions or tags.

let NFCTagResponseUnexpectedLengthErrorKey: String

A user-information dictionary key that indicates an invalid received response packet length.