User Guide for iOS SDK

This Quick Start guide will walk you through the key concepts behind AIQ’s SDK and the steps required to get a client app up and running.

For a more comprehensive guide we have divided into 3 different tutorials, which AIQ's SDK collective currently supported:

Quick Start

This section summarizes the steps to use aiqkit in your iOS project. To start, users would need to login to AIQ’s client portal, obtain your app’s unique AppID and Secret, ingest some materials into our CRM under your account.

Note

The App ID is shared across Operating Systems, including Android and iOS now, if the ingestion is shared

1. AppID and Ingestion

Before using the sdk, an AppID/Secret pair is required. This can be obtained from the client portal at https://client.aiq.tech/, for trial users please use staging server https://client.staging.aiq.tech/. You also need to ingest some image/pdf/video before you can search for them.

The tutorials after this guide use a demo AppID/Secret pair, together with some images and videos ingested to the staging system to avoid you the hassle of ingesting your own content before you can test.

2. Installation

There are 2 ways to install aiqkit library:

  • Using Cocoapods
  • Manual download and configuration.

To enable you use aiqkit via cocoapods, we published the SDK in cocoapods.org at https://cocoapods.org/pods/AIQKit where you can also find some useful information about the SDK.

Whichever method you choose depends on your preference and whether you use Podfile in your project. If your project is already using Podfile, or you’d like to try it, simply append a pod entry in your Podfile. Or else you can manually download and install the SDK.

2.1. Using Cocoapods

Using CocoaPods, add to your Podfile( if Podfile not exists, create it )

Podfile


pod 'AIQKit'
                    

Run pod install to download the SDK and install it into your project, along with the SDK's dependencies.

2.2. Manual Download and Configuration

Download AIQKit SDK

AIQKit SDK


$> git clone https://github.com/IQNECT-ORG/aiqkit-ios.git

$> cd aiqkit-ios

$> cp -R aiqkit-ios ${YourProjectFolder}/

$> mv ${YourProjectFolder}/aiqkit-ios ${YourProjectFolder}/AIQKit
                    

Do remember replace ${YourProjectFolder} with your project path.

then set search path and library link path from 'Build Settings' of your Xcode project.

3. Initialization

In your App Delegate, initialise the SDK with the AppID and Secret

App Delegate

#import "iQKit.h"
[iQKit setAppID:@"APP-ID"
   andAppSecret:@"APP-SECRET"];

Note: If you use demo App ID and App Secret, remember set the server type to staging, which is mainly for trial users:

Code

[iQKit setAPIServerType:iQKitAPIServerStaging];

There are optional parameters you can set, like age and gender, which in turn helps better understand properties of users.

For best results, report some further information about the user:

Code

[iQKit setUserAge:@(42)];

[iQKit setUserGender:@"f"];

The age and gender can be updated at anytime with these functions.

4. Search

After initialization, you can start searching. The 3 tutorials follow this guide demonstrate 3 ways to search an image.

4.1. Use builtin scanner

The first tutorial shows how to use the builtin scanner to continuously scan and send the query to backend until a match is found. Check out the tutorial here.

4.2. Search an image from photo Gallery

The second tutorial shows how to search a photo from your photo’s Gallery. Check out the tutorial here.

4.3. Search an image from camera

The third tutorial shows how to search a camera captured image. Check out the tutorial here.

5. Privacy Requirements

As SDK requires access to camera and photo library, these two keys need to be declared in info.plist file of your project,

  • Privacy - Camera Usage Description ----> This app requries access to your camera
  • Privacy - Photo Library Usage Description ----> This app requires access to your photos

As shown in below screenshot

6. FAQ

Question 1. Error "This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data"

This is caused by missing of declaration of privacy resource, please refer to 'Privacy Requirements' section