iPhone:如何以编程方式响应短信 [英] iPhone: How to Programmatically Respond to SMS Messages

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

问题描述

在查看iPhone SDK文档后,我 not 仍未找到一种编写应用程序的方式,从而可以以编程方式处理传入内容iPhone平台内的SMS消息.想法是让这样的应用程序在后台运行 ,并基于特定格式的SMS消息能够采取特定的操作.

After a review of the iPhone SDK documentation, I have not yet found a way for an application to be written such that it can programmatically process the content of an incoming SMS message within the iPhone platform. The idea would be for such an application to be running in the background and based on specifically formatted SMS messages would be able to take specific actions.

有人知道iPhone SDK应用程序是否可以实现此功能吗?如果提供,则提供有关如何完成此操作的信息的指针?

Does anybody know if this is possible with an iPhone SDK application and if so, provide a pointer to information about how this can be done?

推荐答案

不幸的是,您无法使用iPhone SDK截获传入的SMS消息,也无法收到通知.

Unfortunately, you cannot intercept - or be notified of - incoming SMS messages with the iPhone SDK.

一种可能的选择是注册一个自定义URL方案,当带有该方案的URL嵌入到sms消息中并且用户点击该URL时,启动该应用程序.

One possible alternative, is to register a custom URL scheme that launches your application when a url with that scheme is embedded in the sms message and the user cicks on it.

要设置自定义网址方案,必须在应用程序的info.plist中同时实现CFBundleURLSchemes和CFBundleURLName键.

to set a custom url scheme, you must implement both the CFBundleURLSchemes and CFBundleURLName keys in your application's info.plist.

然后,在您的应用程序的委托中,您可以实现application:handleOpenURL:方法,以获取从SMS消息中的URL传递到您的应用程序的所有参数.

In your Application's delegate, you can then implement the application:handleOpenURL: method to get any paramaters that were passed to your App from the url in the SMS message.

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

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