问题
Possible Duplicate:
How to programmatically send SMS on the iPhone?
Does someone have an idea how to send sms in iOS5 without using the default iPhone/iPad app? I mean in my app, I have a textbox and button. When I hit the button whatever string that the textbox contains will be sent to the specified recipient. Is it possible? thanks,,
回答1:
It's not possible - you have to use MFMessageComposeViewController.
Example of using MFMessageComposeViewController copying your own text in there:
MFMessageComposeViewController *viewController = [[MFMessageComposeViewController alloc] init];
viewController.body = yourTextField.text;
[self presentModalViewController:viewController animated:YES];
where yourTextField is a UITextField or UITextView for user input.
Note you will also want to set the messageComposeDelegate (probably to self) and conform to the MFMessageComposeViewControllerDelegate protocol, in order to know when to dismiss it.
来源:https://stackoverflow.com/questions/8999844/ios-sending-sms