iphone 4.0 以编程方式发送短信
我正在开发一个简单的应用程序,在其中我需要以编程方式向我的朋友发送短信。 所以编写下面的代码来发送短信。
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];
}
但我不想加载消息选择器并向朋友发送短信。 // [selfpresentModalViewController:pickeranimated:YES];
是否可以在不单击发送按钮的情况下发送短信?
I am working on a simple application in which I need send sms programmatically to my friends.
so write below code for sending sms .
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];
}
but I do not want to load message picker and send sms to friends.
// [self presentModalViewController:picker animated:YES];
is it possible to send sms without click in send button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iOS API 中可用的两个选项是:
MFMessageComposeViewController
- 需要用户确认sms://
URL - 需要用户确认如果您想做其他事情,您需要与 SMS 网关提供商建立基于网络的服务并通过该服务发送消息。我曾经与这样一个具有 HTTP POST 接口的提供商合作,该接口使用起来非常简单。这有几个重要的区别:
另请注意,在审核您的应用程序时,代表用户发送短信而不进行确认可能会遭到反对,尤其是在付费的情况下。
The two options available in the iOS API are:
MFMessageComposeViewController
- requires user confirmationsms://
URLs - requires user confirmationIf you want to do something else, you'll need to set up a network-based service with an SMS gateway provider and send messages via that. I used to work with such a provider that had an HTTP POST interface, which would be simple enough to use. That comes with a couple of important differences:
Also note that sending SMS on your users' behalf without confirmation might be frowned upon when your app is reviewed, especially if they're billed for.