iOS: Sending SMS [duplicate]

▼魔方 西西 提交于 2019-12-11 11:14:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!