Project requirements: In the program development, we need to send some SMS validation in a program (not to receive SMS verification, SMS verification, transmission door: http://www.cnblogs.com/wolfhous/p/5096774.html
Project implementation:
New demo, directly to see my source code signs.
Source screenshot
Real Machine screenshot
It is so simple, if you have any questions/suggestions or better ways to achieve, contact me.
Can see my folded source code
/** Click send SMS Button * *-(Ibaction) Sendmessagebut: (ID) Sender {/** If the text message can be sent (not in the emulator case * * [Mfmessagecomposeviewcontroller
Cansendtext]) {/** Create SMS Interface (Controller */Mfmessagecomposeviewcontroller *controller = [Mfmessagecomposeviewcontroller new]; controller.recipients = @[self.phonetextfield.text];//SMS recipient is a nsarray array controller.body = self.messagebody.text;//
SMS Content controller.messagecomposedelegate = self;//Set agent, Agent is not controller.delegate = self OH!!!
/** Cancel button Color (incidental, can not write) * * Controller.navigationBar.tintColor = [Uicolor Redcolor];
[Self Presentviewcontroller:controller animated:yes completion:nil];
}else{NSLog (@ "Emulator does not support sending SMS");} #pragma mark-mfmessagecomposeviewcontrollerdelegate/** * Protocol method, call (e.g. click Send, Cancel send, send failure) when the information interface finishes processing the information result @param controller Information Controller * @param result return of the information sent to the success of the status * * * (void) Messagecomposeviewcontroller: (Mfmessagecomposeviewcontroller *) Controller didfinishwithresult: (messagecomposeresult) result {/** Send the message back to the original program * * [Self dismissviewcontrolleranimated:
YES Completion:nil]; Switch (resUlt) {case Messagecomposeresultsent:nslog (@ "send success"); break, Case Messagecomposeresultfailed:nslog (@ "send failed");
Case Messagecomposeresultcancelled:nslog (@ "send Cancel");
Default:break; }
}
The above is the introduction of the iOS program to introduce the development of the SMS to send the text of the interface to send the full description of the function, I hope you like.