简体   繁体   English

如何在iPhone中以编程方式发送短信

[英]how can i send sms programmatically in iphone

I need to send sms programmatically. 我需要以编程方式发送短信。

I found sending programmatically email in google,But did n't found clear info regarding sending sms programmatically. 我发现在Google中以编程方式发送电子邮件,但没有找到有关以编程方式发送短信的明确信息。

Can any one pls post some sample code. 谁能张贴一些示例代码。

Thank u in advance. 预先谢谢你。

您可以提示用户发送一条带有要发送的号码的消息以及消息的正文,但是如果用户未完成发送,则无法发送SMS。

Here is a perfect blog that can be used to send sms through application. 是一个完美的博客,可用于通过应用程序发送短信。 SMS sending through application is introduced with iOS4.0 So you can not use MFMessageComposer in the previous versions of iPhone. 通过应用程序发送短信是iOS4.0引入的,因此您不能在iPhone的早期版本中使用MFMessageComposer。

iOS 4 will be the minimum requirement. iOS 4将是最低要求。

hAPPY iCODING... 快乐编码...

-(void)displaySMSComposerSheet 
{
    MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
    picker.messageComposeDelegate = self;
    NSString *str=@"Your String for SMS"
    picker.body=str;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

Use this and add framework MessageUI.framework and call this function whenever you want to send message 使用它并添加框架MessageUI.framework并在要发送消息时调用此函数

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

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