OGeek|极客世界-中国程序员成长平台

标题: ios - iphone 4.0 以编程方式发送短信 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 05:53
标题: ios - iphone 4.0 以编程方式发送短信

我正在开发一个简单的应用程序,我需要在其中以编程方式向我的 friend 发送短信。 所以写下面的代码来发送短信。

MFMessageComposeViewController *picker = [[[MFMessageComposeViewController alloc] init]autorelease];
if([MFMessageComposeViewController canSendText])
{
    picker.messageComposeDelegate = self;   
    picker.recipients =[NSArray arrayWithObject"123"]; 
    picker.body=@"hello";   
    [self presentModalViewController:picker animated:YES];
}

但我不想加载消息选择器并向 friend 发送短信。 //[self presentModalViewController:picker animated:YES];
是否可以在不点击发送按钮的情况下发送短信。



Best Answer-推荐答案


iOS API 中可用的两个选项是:

如果您想做其他事情,则需要使用 SMS 网关提供商设置基于网络的服务并通过该服务发送消息。我曾经与这样一个提供 HTTP POST 接口(interface)的提供商合作,该接口(interface)使用起来非常简单。这带来了几个重要的区别:

另请注意,在审核您的应用时,代表您的用户发送 SMS 而不进行确认可能会遭到反对,尤其是在为他们付费的情况下。

关于ios - iphone 4.0 以编程方式发送短信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3758664/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4