How to detect received SMS message in IPhone?

How to detect incoming SMS in the code? and how can I check if it contains certain strings? for example, I want to send an SMS to an Iphone that contains "specificString", and I want the Iphone receiver to automatically open my application.

+4
source share
2 answers

You cannot receive a notification when a person receives SMS, but you can enter a special URL in this SMS, which will then launch your application when pressed.

In your Info.plist, you must define several key-value pairs: enter image description here

And then your application starts when you click on the url:

yourapp://?foo=1&bar=2 

as you can see, you can pass parameters to your application.

In your application, you receive a special event when your application is launched from a 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 } 

See the documentation for more details: "Implementing Custom URL Schemas"

Edit after WWDC Keynote 06/06/2011

The new iMessaging API now supports messaging on the iPad, as well as receipts to see if your message has been delivered.

+4
source

You cannot achieve what you are trying to do. Apple restricts such things because it means spying on the user who uses your application.

+2
source

All Articles