1. Register the app to obtain appKey and appSecret

(1) Register as a Mob developer on Mob’s official website;

(2) Go to the application management background to create an application.

For details on how to register, please click this documentation

2. Integrate SMSSDK

(1) Cocoapods integration

To install through CocoaPods, simply add to your Podfile:

` ` `

pod ‘mob_smssdk’

` ` `

Run the pod install/pod update command.
(2) Manual integration
1. Obtain SMSSDK:
Click on the link to download the latest VERSION of SDK and extract the following file structure:



2. Import the SDK:

Drag the folders marked with red boxes in the following figure (containing mobfoundation.framework and sms_sdK.framework) into the project



Confirm that it is checked and click Finish to complete the import



3. Add dependency libraries:

List of libraries required by SDK:

Necessary:

libz.dylib

libicucore.dylib

MessageUI.framework

JavaScriptCore.framework

libstdc++.dylib

Note: If running on XCode7 generates errors, you need to add these dependency libraries

SystemConfiguration.framework

CoreTelephony.framework

AdSupport.framework

Optional:

Addressbook. framework (AddressBook function required)

AddressBookUI. Framework (Address book function required)



3. Configure AppKey and appSecret

Add a key-value pair to the info.plist file in the project. The key is MOBAppKey and MOBAppSecret, and the value is the appkey and appSecret obtained in Step 1

Configuration address book friends function needed for the private key, the key is: NSContactsUsageDescription



Use SDK to send and verify the verification code

Import header file

` ` `

#import <SMS_SDK/SMSSDK.h>

` ` `

Request SMS verification code


` ` `

// With custom templates

  [SMSSDK getVerificationCodeByMethod:SMSGetCodeMethodSMS phoneNumber:@”13800138000″ zone:@”86″ template:@”123456″ result:^(NSError *error) {

 

if (! error)

        {

// The request succeeded

        }

        else

        {

            // error

        }

    }];

` ` `

` ` `

// No custom templates

[SMSSDK getVerificationCodeByMethod:SMSGetCodeMethodSMS phoneNumber:@”13800138000″ zone:@”86″  result:^(NSError *error) {

 

if (! error)

        {

// The request succeeded

        }

        else

        {

            // error

        }

    }];

` ` `

Note The TEMPLATE ID is added to the SMS template under the SMSSDK product on the official website. (The SMS template can be added only after the application has applied for a custom SMS signature.)



Submit the SMS verification code

Objective-C

` ` `

[SMSSDK commitVerificationCode:@”1234″ phoneNumber:@”13800138000″ zone:@”86″ result:^(NSError *error) {

 

if (! error)

        {

// Verification succeeded

        }

        else

        {

            // error

        }

    }];

` ` `