iPhone: Is it possible to go back to the previous application after handling custom URL?
-
02-03-2021 - |
Pregunta
I know that iPhone applications can be launched via a custom URL such as myapp://something. But is there a way to go back to the previous application after handling the custom URL?
For example, I have the following scenario.
- Follow a link from iPhone Twitter application.
- Twitter shows a link that redirects to a custom URL.
- My application is invoked and handles the URL.
- After completing the job, I go back to the Twitter app.
I want my application to handle a custom URL like a modal dialog box. Is it possible?
Solución
While this isn't officially supported, it is totally doable: take a look at the x-callback-url spec. It's been implemented by several apps, like Due and Instapaper:
Otros consejos
That I guess is not possible unless both apps are yours and you implement a custom url for each other.
The method that you use to handle launching app from a custom URL has a param called source application which gives you info about the bundle ID of the app that launched your app. Maybe try using that to launch the calling app again.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation