SMS Verification of iOS development

Source: Internet
Author: User

Here the use of sms_sdk.framework (Mob official website to download) to do the SMS verification, the operation is very simple, to register their own account to get appkey then it is necessary to import some library files need to import the library has Security.framework Foundation.framework, Uikit.framework, Coregraphics.framework, Libicucore.dylib, Libz.lib, Addressbook.framework, Addressbookui.framework, Messageui.framework and Sms_sdk.framework

First, determine if the phone number is correct and set the limit time for SMS if ([_field.text length] = =) {                [sms_sdk getverifycodebyphonenumber:_field.text andzone:@ "result:^" (enum Sms_getverifycoderesponsestate state) {            if (1 = = state) {                self.times =;                Self.timer = [Nstimer scheduledtimerwithtimeinterval:1 target:self selector: @selector (buttonactionshow) UserInfo:nil Repeats:yes];                [Nstimer scheduledtimerwithtimeinterval:15 target:self selector: @selector (Xianzhi:) Userinfo:nil repeats:no];            } else {                NSLog (@ "filed");            }        }];    } else {        Uialertview *aler = [[Uialertview alloc] Initwithtitle:nil message:@ "Input phone number is wrong" delegate:self cancelbuttontitle:nil otherbuttontitles:@ "OK", nil];        [Aler show];    }

  

Verify correct [sms_sdk commitVerifyCode:self.phone.text result:^ (enum sms_responsestate state) {        if (state = = 1) {            Uialertview *aler = [[Uialertview alloc] Initwithtitle:nil message:@ "Verify success" Delegate:self Cancelbuttontitle:nil otherbuttontitles:@ "OK", nil];            [Aler show];                    } else {            Uialertview *aler = [[Uialertview alloc] initwithtitle:nil message:@ "input captcha Error" delegate:self Cancelbuttontitle:nil otherbuttontitles:@ "OK", nil];            [Aler show];        }    }];

  

Xianzhi Method--written here pinyin-(void) Xianzhi: (ID) sender{    [_button Setenabled:yes];    [_timer invalidate];    _timer = nil;    [_button setalpha:1];    [_button settitle:@ "regain" forstate:uicontrolstatenormal];    }

  

Timer countdown self.times--;    self.button.enabled = NO;    [Self.button settitle:[nsstring stringwithformat:@ "%ld seconds", Self.times] forstate:uicontrolstatenormal];

  

SMS Verification of iOS development

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.