0

Trying to figure out if you can send any sort of response back to an application that calls another application through a custom URL scheme.

For example, the 'client' app does the following:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"myappscheme://"]];

And another app that is registered for myappscheme:// has the following:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    // Do something
    return YES;
}

The question is can I get information (Even just a char array) back to the application that called openURL as a response. I realize I could just have the 'client' make it's own custom URL scheme, but I would like to avoid that if possible.

Gavin Black
  • 136
  • 9
  • Unless you make a call back to the client through a URL scheme then no (that would also be horribly messy UX). Apple prohibits apps from communicating with each other unless it's via URL Scheming. – NinjaLikesCheez Nov 21 '13 at 15:50
  • @rmaddy I'm asking if that is really the only way. But I guess if it is, then it is essentially the same. Seems odd that there isn't a standard request->response model though. – Gavin Black Nov 21 '13 at 16:00
  • That's it unless both apps are from the same developer. Then you can share data using a private, named pasteboard. – rmaddy Nov 21 '13 at 16:01
  • Yep, had considered that route, but it seemed kludgey and hard to make it event driven. Might just end up using a combination of the two. Custom URL that contains a private pasteboard name, the app registered to the custom URL then pastes the response to that pasteboard. Very ugly, but would work. Will leave this open a while longer though to see if there is anything cleaner (Although it seems unlikely) – Gavin Black Nov 21 '13 at 16:07

1 Answers1

0

Only way to do it has been to use a custom URL scheme, that sends the name of a unique pasteboard, that then acts a temporary communication channel for the two applications.

Gavin Black
  • 136
  • 9