0

I'm using this function in my app, to handle calls from other applications:

(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

I need to understand how can I re-launch the app that has launched my app after I finished handling the request.

In short - I need the source app to be in foreground once I have finished handled issues in my app.

Here the flow:

  1. User click on some button on 3rd party's app (it can be any app, not a specific one)
  2. the button uses

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:sourceApplication]]

to open my app.
  1. I perform some actions in my app.
  2. The 3rd party's app (source app) re-opened.

Any ideas?

Thanks!

(btw - I think that Facebook API does that too, but not sure.)

Filip Radelic
  • 26,607
  • 8
  • 71
  • 97
taxman
  • 501
  • 11
  • 21

1 Answers1

3

Facebook does that because they know your app's url since you have to add fb[APPID] url where [APPID] is your Facebook app ID.

There is this idea for a specification that handles what you want: http://x-callback-url.com but in order to use it, both apps would have to support it.

Using x-callback-url’s source apps can launch other apps passing data and context information, and also provide parameters instructing the target app to return data and control back to the source app after executing an action.

Filip Radelic
  • 26,607
  • 8
  • 71
  • 97
  • thanks, I was wondering how FB does it and thought they must use a URL scheme .. there still (io6) isnt another way, is there? – Daij-Djan Nov 22 '12 at 14:53
  • 1
    Yeah, custom url is still the only public way. – Filip Radelic Nov 22 '12 at 14:54
  • In this function : (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation - I receive the source app url (for ex: sourceApplication = com.apple.safari...). can't I use it? – taxman Nov 22 '12 at 15:10
  • That's source app id, not url. – Filip Radelic Nov 22 '12 at 16:05