fabio santos fabio santos - 6 months ago 15
iOS Question

Cocoa - Return to native app after "openURL"

I've an app, that permits me to call to my contacts. I use the following code to do that:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:numberVar]];


The call is made, but the problem is that when I finish the call, the ios don't turn back to the app. Is there anyway of doing that? When the user click the "end call" the ios come back to the app.

Thanks a lot!

Answer

You want to use IPC (inter process communication), which is a bit odd in iOS apps: You need to register a protocol handler in your app and place a link in the HTML page you're displaying with openURL. E.g. your link could start with something like "myapp://" instead of "http://".

Look here: http://mobileorchard.com/apple-approved-iphone-inter-process-communication/