Skip to content

Objective C Support

Jonathan Ellis edited this page Sep 24, 2019 · 5 revisions

Introduction

We strongly recommend Swift for the cleanest and easiest integration. However, if you're still using Objective-C in your app, don't worry... you can still integrate iProov!

We have developed a convenient wrapper to provide an ObjC-friendly API. It is a little more clunky, however you can still access all of the same SDK functionality, and there is no difference in terms of the user experience whether you integrate from Swift or ObjC.

The key differences between integrating from Swift and ObjC are as follows:

  1. Objective-C does not support default parameter values, so you must specify all parameters when launching the SDK (if you just want the defaults, you can just explicitly pass https://eu.rp.secure.iproov.me as the streaming URL and [Options new] to get the default set of options).
  2. Objective-C does not support Swift enums with associated values, so instead of a single status-based callback, the ObjC API has been adapted with multiple callbacks.

Be sure to follow the main README. The installation (Cocoapods/Carthage) steps still apply, as does adding the NSCameraUsageDescription to your Info.plist.

Sample code

#import <iProov/iProov-Swift.h>

[IProov launchWithStreamingURL:@"https://eu.rp.secure.iproov.me"
                         token:@"{{ your token here }}"
                       options:[Options new]
                    processing:^(double progress, NSString * _Nonnull message) {
                        // ...
                    } success:^(NSString * _Nonnull token) {
                        // ...
                    } cancelled:^{
                        // ...
                    } failure:^(NSString * _Nonnull reason) {
                        // ...
                    } error:^(NSError * _Nonnull error) {
                        // ...
                    }];
Clone this wiki locally