How to access and open the iPhone's SMS API fr

2020-02-13 03:02发布

In my iPhone app, I need to access the SMS application.

I need that when I click a button in my iphone app. It should open the SMS app of iphone and preload the message body with the text that I specify in my app.

How can we access the SMS API from iPhone app?

What should be done?

2条回答
贼婆χ
2楼-- · 2020-02-13 03:42

This is possible starting from iOS 4.0; use the MFMessageComposeViewController from the MessageUI Framework.

Details and example: http://developer.apple.com/library/ios/#samplecode/MessageComposer/Introduction/Intro.html

查看更多
来,给爷笑一个
3楼-- · 2020-02-13 03:49

Try this :

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

pickerSMS.body = @"hello!";

[self presentModalViewController:pickerSMS animated:YES];
[pickerSMS release];
查看更多
登录 后发表回答