Skip to main content

Preparation

To setup iOS SDK correctly, you must complete the steps below.

Requirements

The minimum requirements for this SDK are:

  • iOS 13.0 and higher
  • Xcode 14 and higher
note

Required iOS version if you're are planning to use the NFC is 13.0 or higher

If your app will be compiled for devices that doesn't have NFC support, you must do these steps.

Installation

Via Cocoapods

Adapt your Podfile and add the Amani SDK

Add lines to first line of pod file

source "https://github.com/AmaniTechnologiesLtd/Mobile_SDK_Repo"
source "https://github.com/CocoaPods/Specs"

And then you can add the pod as shown below.

pod 'AmaniUI'

Add our post install hook

post_install do |installer|
xcode_base_version = xcodebuild -version | grep 'Xcode' | awk '{print $2}' | cut -d . -f 1

installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
# This block is for xcode 15
if config.base_configuration_reference && Integer(xcode_base_version) >= 15
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
if target.name == 'AmaniSDK'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
if target.name == 'AmaniUI'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
end
end

Required Permissions

Amani SDK makes use of the device's Camera, Location and NFC. If you dont want to use location service please provide in init method. You must have the following keys in your application's Info.plist file:

note

You need to add all keys according to your usage.

For NFC

<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
</array>
<key>NFCReaderUsageDescription</key>
<string>This application requires access to NFC to scan IDs.</string>

For Location

<key>NSLocationWhenInUseUsageDescription</key>
<string>This application requires access to your location to upload the document.</string>
<key>NSLocationUsageDescription</key>
<string>This application requires access to your location to upload the document.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This application requires access to your location to upload the document.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This application requires access to your location to upload the document.</string>

For Camera

<key>NSCameraUsageDescription</key>
<string>This application requires access to your camera for scanning and uploading the document.</string>

Grant accesss to NFC

Enable the Near Field Communication Tag Reading capability in the target Signing & Capabilities.

Xcode 14 Sign &amp; Capabilities

Supporting non-NFC devices

For non NFC supported device (like iPhone 6) there is no CoreNFC library in system and also we are using some ios crypto libraries for reading nfc data supported after iOS 13. You need to add below listed libraries as optional under Build Phases->Link Binary With Libraries menu. Even if you don't use the nfc process, you should add for compiling your app correctly.

CoreNFC.framework
CryptoTokenKit.framework
CryptoKit.framework