IOS SMS Authentication

Source: Internet
Author: User

SMS Verification

Now a lot of SMS verification platform, we are more commonly used mobile developer service Platform

Integrate with SMS verification documentation

1. Find The integrated development documentation for IOS SMS verification

2. Download the SDK and Demo directory structure

3. run Demo

4. Write your own test Demo to follow the documentation step-by -step .

1. Create a project

2. import svprogresshud and sms_sdk

3. add dependent library files

    • Necessary:
      Libicucore.dylib
    • Libz.dylib
    • Messageui.framework
    • Javascriptcore.framework
    • Libstdc++.dylib
    • Optional:
      Addressbook.framework (Address Book function required)
    • Addressbookui.framework (Address Book function required)


    • 3. Add in the info.plist file , set the use of unsafe network
      Nsapptransportsecurity Type Dictionary
    • Nsallowsarbitraryloads = YES Type BooL

    • 4. Add initialization code
    • Add in Appdelegate
      #import <SMS_SDK/SMSSDK.h>

    • And
      -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
    • Sign up for SMS verification
    • [Smssdk Registerapp:appkey Withsecret:appsecret];
    • return YES;
    • }

    • Acquisition of AppKey and Appsecret:
        1. Register as a mob developer on the mob website;
        2. Create a new app in the app management background.
    • Create a button to get a CAPTCHA, or call a method to get a verification code in a button event of an existing interface
      -(ibaction) Verifyvoice {
    • NSString *phonenumber = Self.phoneNumTextField.text;
    • Get Voice Verification Code
    • [Smssdk getverificationcodebymethod:smsgetcodemethodvoice phonenumber:phonenumber zone:@ "CustomIdentifier:nil" result:^ (Nserror *error) {
    • Note that the area code (zone) and mobile phone number (PhoneNumber) do not add "+" number, some developers like to write, @ "+86", this is the wrong way of writing
    • if (Error) {
    • NSLog (@ "%@", error);
    • [Svprogresshud showerrorwithstatus:@ "Please re-obtain the verification Code"];
    • }
    • }];
    • }
    • Create a button that submits a verification code, or invoke a method to submit a verification code in a button event of an existing interface
      Verify
    • [Smssdk commitVerificationCode:self.verifyTextField.text phoneNumber:self.phoneNumTextField.text zone:@ "The result" : ^ (Nserror *error) {
    • if (Error) {
    • NSLog (@ "%@", error);
    • [Svprogresshud showerrorwithstatus:@ "validation failed!"];
    • }else{
    • [Svprogresshud showsuccesswithstatus:@ "verified success!"];
    • }
    • }];
    • Note: Now carrier restrictions: The same number 12 hours to send no more than 5, 24 hours not more than 10

IOS SMS Authentication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.