在iPhone上以编程方式发送短信 [英] send sms programmatically on iPhone

查看:92
本文介绍了在iPhone上以编程方式发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想在特定事件中将预定义的smstext发送到一个数字, 如何发送这样的短信?

in my application I want to send predefine smstext to one single number on certain event , how to send sms like that?

推荐答案

在没有用户干预的情况下,您无法发送SMS.但是,通过用户的批准",有两种方法可以从iPhone应用程序发送短信.

You cannot send an SMS without user intervention. However, with the user's "approval" there are two ways to send an SMS from an iPhone application.

  1. Apple的 MessageComposer 示例项目中的代码向您展示了如何使用MFMessageComposeViewController类发送SMS.
  2. 或者,您可以使用:

  1. Apple's MessageComposer sample project has code that shows you how to send an SMS using the MFMessageComposeViewController class.
  2. Alternatively, you can use:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:1-408-555-1212"]];

这篇关于在iPhone上以编程方式发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆