如何在 iphone 2.0 中以编程方式发送短信
我需要在 iphone os 2.0 中以编程方式发送电子邮件。
我发现
NSString *url = [NSString stringWithString: @"mailto:[email protected][email protected]&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
这是 iphone os 2.0 上的代码。
同样,我需要在 iphone 2.0 中发送短信并拨打电话。
我发现在iphone 2.0中无法发送短信和拨打电话。
有没有第三方的短信发送工具?
I need to send email programmatically in iphone os 2.0.
some where i found
NSString *url = [NSString stringWithString: @"mailto:[email protected][email protected]&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
is this is code work on iphone os 2.0.
similarly I need to send sms in iphone 2.0 and make a call.
I found it is not possible in sending sms in iphone 2.0 and making call.
Is there any third party tools to send sms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在任何版本的 iOS 下,您都无法以编程方式发送短信。
在 iOS 2 和 3 中,您可以向 SMS 应用程序提供
sms://
链接,并且可以包含要发送到的号码,但仅此而已。您不能包含邮件正文,并且无论如何您都永远发送邮件。用户必须发送消息。在 iOS 4 下,您可以使用 MFMessageComposeViewController 向视图控制器提供要发送的号码和消息正文,但您仍然无法发送消息。用户可以点击发送按钮,但仅此而已。
Apple 特别保护 iPhone 用户免遭在未经其知情和批准的情况下发送短信的情况。
You cannot send an SMS programmatically under any version of iOS, ever.
Under iOS 2 and 3 you can present the SMS app with a
sms://
link and you can include the number to send it to, but that's it. You cannot include the message body, and no matter what you can never send the message. The user must send the message.Under iOS 4 you can present a view controller with the number to send it to and the message body using
MFMessageComposeViewController
, but you still cannot send the message. The user can tap the send button, but that's it.Apple specifically protects iPhone owners from SMS messages being sent without their knowledge and approval.
要从您的应用程序拨打此电话:
请记住,这在模拟器中不起作用,您可能需要在拨打之前检查设备是否是 iPod 或 iPad!我还倾向于显示一个
UIAlertView
询问用户是否真的想要拨打该号码,因为如果他们不是故意的,这可能会非常烦人。对于短信:查看此如何在 iPhone 上以编程方式发送短信?< /a>
To make a call from your app call this line:
Remember this won't work in the Simulator and you may want to check if the device is an iPod or iPad before calling! I also tend to show a
UIAlertView
asking the user if they actually want to call the number as this can be very annoying if they didn't mean it.For SMS: Check out this How to programmatically send SMS on the iPhone?