Skip to main content

[BETA] NFC Scan - Integration & Usage Guide

Prerequisites​

  • iOS 13+ (even though IncdOnboarding supports iOS 11+, NFC Scan module will not be executed on devices with iOS <13).
  • IncdOnboarding variant including "-nfc", eg. version "5.15.0-s-nfc".

Integration​

  • Turn on Near Field Communication Tag Reading under the Capabilities tab for the project’s target. This step:

    • Adds the NFC tag-reading feature to the App ID.
    • Adds the Near Field Communication Tag Reader Session Formats Entitlement to the entitlements file.
  • Add the NFCReaderUsageDescription key as a string item to the Info.plist file. For the value, enter a string that describes the reason the app needs access to the device’s NFC reader. If the app attempts to read a tag without providing this key and string, the app will crash.

  • Add interface for interacting with an ISO 7816 tag to App's Info.plist:

<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>A0000002472001</string>
<string>00000000000000</string>
</array>
  • Add OpenSSL.xcframework to your project. (should be Embedded & signed)

  • In build settings for key LD_RUNPATH_SEARCH_PATHS add path @executable_path/Frameworks.

NOTE​

If your app supports devices with iOS prior to 13.0, you will also need to set CoreNFC.framework and CryptoTokenKit.framework as an optional frameworks: 1) Select your app target 2) Under Build Phases -> Link Binary With Libraries add: CoreNFC.framework, CryptoTokenKit.framework and SwiftUI.framework libraries if they are already not on the list. 3) And finally, for all three libraries, under Status, select Optional.

Note that even though NFC Scan module will not be performed on devices with iOS version older than 13, these steps are required because otherwise the app will crash on launch time.

Usage​

To add NFC Scan module to the flow, simply:

1) Add it to a IncdOnboardingFlowConfiguration:

  flowConfig.addNfcScan(showNFCSymbolConfirmationScreen: true/false, processNFCData: true/false)

In case your app supports iOS versions lower than 13, you'll have to add it conditionally:

  flowConfig.addNfcScan(showNFCSymbolConfirmationScreen: true/false, processNFCData: true/false)

2) Add callback to your IncdOnboardingDelegate:

  func onNFCScanCompleted(_ result: NFCScanResult) { 
// process result
}
Parameters for addNfcScan():​
  • showNFCSymbolConfirmationScreen: Show Is NFC Available screen. Default is true.
  • showInitialDataConfirmationScreen: Show edit OCR screen at beginning of module. Default is true.
  • processNFCData: A Boolean value that indicates whether to proces NFC data on backend or not. Default is true.
Returning result of the module is a 'NFCScanResult' struct which contains:​
  • facePhoto: A face photo extracted from NFC chip.
  • dg1: DG1 data extracted from NFC chip.
  • error: An NFC Scan error. nil means there were no errors.
Possible values for NFCScanError:​
  • error(_ error: IncdError): The associated value contains the specific IncdError case.
  • notAvailable: NFC scan is not available. Most likely device's iOS version is below 13.0.
  • userDocumentHasNoChip: User selected NO for NFC chip availability.
  • noScanAttemptsRemaining: User has used all NFC scan attempts without success.

License​

Copyright 2023 Incode Technologies. All rights reserved.