简体   繁体   English

如何从iPhone应用程序访问和打开iPhone的SMS API

[英]How to access and open the iPhone's SMS API from an iPhone app

In my iPhone app, I need to access the SMS application. 在我的iPhone应用程序中,我需要访问SMS应用程序。

I need that when I click a button in my iphone app. 当我单击iPhone应用程序中的按钮时,我需要使用它。 It should open the SMS app of iphone and preload the message body with the text that I specify in my app. 它应该打开iPhone的SMS应用程序,并使用我在应用程序中指定的文本预加载消息正文。

How can we access the SMS API from iPhone app? 我们如何从iPhone应用程序访问SMS API?

What should be done? 应该做什么?

This is possible starting from iOS 4.0; 从iOS 4.0开始,这是可能的; use the MFMessageComposeViewController from the MessageUI Framework. 使用MessageUI框架中的MFMessageComposeViewController

Details and example: http://developer.apple.com/library/ios/#samplecode/MessageComposer/Introduction/Intro.html 详细信息和示例: http : //developer.apple.com/library/ios/#samplecode/MessageComposer/Introduction/Intro.html

Try this : 尝试这个 :

MFMessageComposeViewController *pickerSMS = [[MFMessageComposeViewController alloc] init];
pickerSMS.messageComposeDelegate = self;

pickerSMS.body = @"hello!";

[self presentModalViewController:pickerSMS animated:YES];
[pickerSMS release];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM