How to detect an arrived sms message in IPhone?
How to detect an arrived SMS in code? and how can I auto check if it contains specific strings? for example I wanna send SMS to the Iphone which contains "specifString" and I want the receiver Iph开发者_如何学Pythonone auto open my app.
You cannot, get a notification when a person receives a SMS, but you can enter a special url in that SMS that then would launch your application when clicked.
In your Info.plist you have to define some key-value pairs:
And then your app is launched when url like this is clicked:
yourapp://?foo=1&bar=2
as you can see, you can pass parameters to your app.
In your app you get a special event, when your app is launched from an url.
4.1 and earlier:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
// Do something with the url here
}
**4.2 and later **
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
// Do something with the url here
}
More details in documentation: "Implementing Custom URL Schemes"
Edit after WWDC Keynote 06.06.2011
New API iMessaging now supports messaging on iPad and also receipts to know if your message has been delivered.
You can not achieve what you are trying to do. Apple restricts this kind of things, because this amounts to spying on the user who uses your application.
精彩评论