Method One
Jump directly to the text messaging interface, but cannot specify the text message content, and can not automatically return to the original application
Nsurl *url = [Nsurl urlwithstring:@ "sms://10010"];
[[UIApplication sharedapplication] openurl:url];
Method Two:
If you want to specify a text message, you have to use the MESSAGEUI framework
Include primary header file
#import <MessageUI/MessageUI.h>
Display the controller that sent the text message
Mfmessagecomposeviewcontroller *VC = [[Mfmessagecomposeviewcontroller alloc] init];
Set SMS Content
Vc.body = @ "Have you eaten yet?" ";
Set up a recipient list
vc.recipients = @[@ "10010", @ "02010010"];
Set up Proxy
Vc.messagecomposedelegate = self;
Display Controller
[Self PRESENTVIEWCONTROLLER:VC animated:yes completion:nil];
Proxy method, when the SMS interface is closed when the call, after the end will automatically return to the original application
-(void) Messagecomposeviewcontroller: (Mfmessagecomposeviewcontroller *) controller didfinishwithresult: ( Messagecomposeresult) Result
{
Close the SMS interface
[Controller Dismissviewcontrolleranimated:yes Completion:nil];
if (result = = messagecomposeresultcancelled) {
NSLog (@ "Cancel send");
} else if (result = = Messagecomposeresultsent) {
NSLog (@ "already issued");
} else {
NSLog (@ "send failed");
}
}
SMS for some small features commonly used in iOS