Recently have learned a small skill, here to summarize, share to everyone, communicate with each other.
The first is the general steps:
- Register on the Mob website and add the app for SMS verification
- Importing frames using Cocoapods
podfile File:Platform:ios, "6.0" target ' SMS verification ' # Mob product Public Library
Pod ' MOBFOUNDATION_IDFA '
# smssdk must be pod ' smssdk ' End
3. Register the application in Appdelegate Appkey
4. Get the Verification code
5. Submit the Verification Code
6. Note: Fit to remember to turn on HTTPS
1. In AppDelegate
the
// Register Appkey [smssdk registerapp:@ "14810905c09b0" withsecret:@ " fbea3e77174d8c9da1d0839b1f0bdc82"];
Such as:
2. SMS and language can be implemented in one simple way
/** * SMS Verification Code*/-(ibaction) messageverify {//Verify that the phone number is legitimateNSString *phonenumber =Self.phoneNumber.text; if(![PhoneNumber Isphone]) {NSLog (@"you entered the phone number incorrectly"); return; } self.savephonenumber=PhoneNumber; //Get SMS Verification Code[Smssdk getverificationcodebymethod:smsgetcodemethodsms Phonenumber:phonenumber Zone:@" the"Customidentifier:nil result:^ (Nserror *error) { if(Error) {NSLog (@"failed to get verification code:%@", error); }Else{NSLog (@"Get Verification Code Success"); } }];}/** * Language Verification Code*/-(ibaction) voiceverify {//Verify that the phone number is legitimateNSString *phonenumber =Self.phoneNumber.text; if(![PhoneNumber Isphone]) {NSLog (@"you entered the phone number incorrectly"); return; } self.savephonenumber=PhoneNumber; //get voice Verification code[Smssdk getverificationcodebymethod:smsgetcodemethodvoice Phonenumber:phonenumber Zone:@" the"Customidentifier:nil result:^ (Nserror *error) { if(Error) {NSLog (@"failed to get verification code:%@", error); }Else{NSLog (@"Get Verification Code Success"); } }];}/** * Verify*/-(ibaction) Verifyresult {//Verify that the verification code is legitimateNSString *verifycode =Self.verifyLabel.text; if(Verifycode.length! =4) {NSLog (@"Verify input Errors"); return; } //Submit Verification Code[Smssdk Commitverificationcode:verifycode PhoneNumber:self.savePhoneNumber Zone:@" the"result:^ (Nserror *error) { if(!error) {NSLog (@"Validation Successful"); }Else{NSLog (@"error message:%@", error); } }];}
The example above is the use of the Mob default text message format, can also be customized, according to their own situation to choose.
There are some other modifications that you can use to read the SDK documentation on the mob to integrate the form you need.
iOS use skills-SMS, language Verification Code acquisition and verification summary