CheckMobi Remote Config SDK For iOS
CheckMobi Remote Config SDK for iOS allows the users to integrate CheckMobi validation methods on iOS in a very efficient and flexible manner without wasting their time to write the logic for any validation flow.
- Integration with few lines of code
- You can change the verification flow directly from the CheckMobi website, on the fly, without deploying a new client version.
- The CheckMobi complete suite of verification products (SMS, Voice, Missed Call) creates a variety of flows that you can test instantly with few lines of code.
- Customize different validation flows by country, operator or even number and split test to validate improvements.
- It's completely open source. In case the API doesn't allow you to customize the UI as you wish, you can anytime clone it and change the code.
CheckMobiSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CheckMobiSDK'
To run the example project, clone the repo, and run pod install
from the Example directory first.
The repo contains a demo app which can be used to test the product without having to integrate into a new project.
In order to do this just:
- Clone the repo
- Open the project in Xcode
- Open ViewController.swift and search for the variable
CheckMobiManager.shared.apiKey
and set it's value/ or input key in interface using UITextField to your CheckMobi Secret Key from web portal. - Run the project on a device
In order to use the SDK you need in the first time to set the CheckMobi Secret Key from the web portal. You can do this somewhere before calling any SDK method by calling:
Swift
CheckMobiManager.shared.apiKey = "YOUR_SERET_KEY_HERE"
Objective-C
CheckMobiManager.shared.apiKey = @"YOUR_SERET_KEY_HERE";
The first thing you need to do is to check if the user has already verified his number. You can do this like so:
Swift
let phoneNumber = CheckMobiManager.shared.verifiedPhoneNumber
Objective-C
NSString *phoneNumber = CheckMobiManager.shared.verifiedPhoneNumber;
If verifiedNumber
is not nil, your user has verified his number and you should allow him to continue using the app otherwise
you should redirect him to the validation process.
To start a validation process you should add the following lines of code:
Swift
CheckMobiManager.shared.startValidationFrom(viewController: self, delegate: self)
Objective-C
[CheckMobiManager.shared startValidationFromViewController:self delegate:self];
You should also implement the CheckMobiManagerProtocol
methods like so:
Swift
public func checkMobiManagerDidValidate(phoneNumber: String, requestId: String) {}
public func checkMobiManagerUserDidDismiss() {}
Objective-C
- (void)checkMobiManagerDidValidateWithPhoneNumber:(NSString *)phoneNumber requestId:(String *)requestId {}
- (void)checkMobiManagerUserDidDismiss {}
Behind the scene the SDK is using the CheckMobi REST API.
First is doing a call to Get Remote Config Profile which returns the validation flow for the specified destination as configured in the CheckMobi Web Portal.
Then based on the profile received the app it's using the Request Validation API and Verify PIN API to implement the desired validation processes.
The select country picker is populated using the information received from Get Countries API.
checkmobi, support@checkmobi.com
CheckMobiSDK is available under the MIT license. See the LICENSE file for more info.