📱iOS Programming

iOS Xcode Project Setup

These instructions assume a development methodology leveraging Swift programming language; you will be adding the AuthenticAction™ SDK to your iOS project within Xcode. A programmatic interface to the IronVest SDK is provided using standard iOS framework architecture.

Xcode and the Xcode logo are trademark and property of Apple Inc.

Setup Method 1: Adding dependencies using SPM

IronVest will supply the necessary libraries in the form of a zip file containing the Swift Package. Complete the following steps to import the framework into your Xcode project:

  • Download the .zip which contains Collector Framework

  • Unzip the contents of the zip file

  • Move "Collector" folder inside your project. Place it as illustrated below.

Figure 1. Move unzipped "collector" folder inside your project.
  • Open your project in Xcode.

  • Select Project, Open Project Settings, Switch to Package Dependencies & Click add (as illustrated below)

Figure 2. Add Package Dependencies
  • Now Click on "Add Local" as illustrated below

Figure 3. "Add Local" package
  • Select the package which you added locally

Figure 4. Select the "collector" directory & click on "Add Package"
  • Now, Select all packages & select Target in which you wish to add those packages

Figure 5. Choose All packages & add it to your Target
  • After import, this is how your project structure would look like & at the bottom, it would show up dependency which we just added.

Figure 6. "collector" as a Package Dependency in Project Navigator View

Linking and Embedding the SDK Framework

Ensure that the dependency is available to your application, Open Project settings, select target, switch to General Tab & make sure that dependency is added as illustrated below.

Figure 7. Make Sure dependency is added correctly

Setup Method 2: Using CocoaPods

Open your project's Podfile and add following line

Make sure that you specify full path of the SDK.

Setting Permissions in Info.plist

For specific functionalities that the collector framework leverages, the user will be prompted to allow the permissions. To inform your user and increase the likelihood that they will allow the permission when prompted, you will need to ensure the appropriate permissions explanations are set in your bundles Info.plist file.

Specifically, the collector framework leverages the camera and screen capturing functionalities. To set these permissions descriptions within your Xcode project, follow these steps:

  1. Open the “Info” View in your project settings.

  2. Expand “Custom iOS Application Target Properties” section.

  3. Look for the key “Privacy-Camera Usage Description”; if it is not available, select one of the “+” buttons and scroll down the list to find it and add it to the list.

  4. Change the value to a suitable description for your user, explaining why you want the permission; For example, “$(PRODUCT_NAME) would like camera permission so that AuthenticAction security can protect your session”. (see figure 8).

  5. Add the Key “Privacy – Photo Library Usage Description”, similarly setting the value to something that will make sense to your user (see figure 7), such as “$(PRODUCT_NAME) would like photo library permission so that AuthenticAction security can protect your session”.

Figure 8: Setting the “Privacy – Camera Usage Description” property in your project.

Please refer to a short video clip for a demonstration of how the instructions above are applied.

iOS Application Programming

AASDKManager

AASDKManager is an interface with which you can easily access most of the SDK features.

With AASDKManager, as a programmer, you can focus on utilising features with provided singleton-interface.

Initialising SDK

The general collector allows for using the camera along with some sensor collecting.

You can start listening and collecting sensor events like this:

  • cid = Customer Specific Identifier. This identifier will be provided by IronVest

  • baseUrl = This baseUrl will be provided by IronVest

  • csid = Customer Session Identifier. Usually it's a unique session identifier for each user session. This is the identifier by which the session can be queried during validation or looked for in the dashboard

  • userID = Unique User Identifier.

Update CSID & UserID

If CSID or UserID change later or either of the values was not available during the initial initialization, they can be updated later.

Using camera preview inside a UIKit project

Make sure to add NSCameraUsageDescription to Info.plist

Setup Camera & Preview

Starting the Camera for Authentic Action

NOTE: Make sure to stop the capture, before calling a subsequent startCamera to avoid calling startCamera twice in a row.

Stopping the camera for Authentic Action

NOTE: Make sure to stop the capture, once the authentic action is completed. Without it, front-camera will stay open & your application will keep collecting camera frames and continuously show the green camera indicator to a user.

Capturing Data from Custom Input Fields

In some of the cases, App may need to submit data from custom fields.

E.g. item picker, date picker, segment-control, switch on-off, check-boxes.

For such scenarios, you can use external Event provider.

Here are the input types for such external events.

Troubleshooting

The SDK generates logs throughout its execution. The most recent logs are stored in memory and can be retrieved for problems troubleshooting. Below is an example of how these logs can be put in a variable or in the Pasteboard to be shared with someone else.

Please refer to a short video clip for a demonstration of how the instructions above are applied.

Última actualización