Skip to main content
You are here: iOS SDK

NFC Utilities

readNFC

public func readNFC()

Initiates a new NFC reader/writer session for reading from the passport-enabled tag.

connectedPackageQueryID

public func connectedPackageQueryID(serialNumber: String) async -> String 

For NFC tags that represent an identity, this query will return the public key of the user.

Parameters:

  • serialNumber: The serial number of the connected packaging.

connectedPackageQueryPass

public func connectedPackageQueryPass(serialNumber: String) async -> String 

For NFC tags that represent a PassScan action such as an AirDrop, this query will return the payload that can be submitted to the PassScan function to consummate transaction.

Parameters:

  • serialNumber: The serial number of the connected packaging.

connectedPackagePublish

public func connectedPackagePublish(userAddress: String, serialNumber: String) async 

Claims a connection for a given user address and serial number in the Connected Packaging smart contract.

Parameters:

  • userAddress: The Ethereum address of the user.

  • serialNumber: The serial number of the connected packaging.

connectedPackagePurge

public func connectedPackagePurge(serialNumber: String) async 

Revokes a connection for a given serial number in the Connected Packaging smart contract.

Parameters:

  • serialNumber: The serial number of the connected packaging.

contentsForMessages

public func contentsForMessages(_ messages: [NFCNDEFMessage]) -> String 

Returns the ABI (Application Binary Interface) of a smart contract.

Parameters:

  • contractName: The name of the smart contract.

  • Returns: The ABI data of the smart contract.

getTagInfos

public func getTagInfos(_ tag: __NFCTag) -> [String: Any] 

Given an NFC tag, this function returns information about it in a dictionary format.

Parameters:

  • tag: an __NFCTag instance that represents the NFC tag.

  • Returns: a dictionary with information about the tag.

readerDidBecomeActive

public func readerDidBecomeActive(_ session: NFCReader)

This function is called when the NFC reader becomes active.

Parameters:

  • session: an instance of NFCReader that represents the session.

reader

public func reader(_ session: NFCReader, didInvalidateWithError error: Error)

This function is called when the NFC reader fails to read or write to a tag.

Parameters:

  • session: an instance of NFCReader that represents the session.

  • error: an Error instance that contains information about the error that occurred.