简体   繁体   中英

iOS9 URL Scheme return to launching app

iOS9 has introduced some changes to how URL schemes work, eg url whitelist etc. Prior to iOS9 we allowed our app to be launched from another app, perform some actions and then return control to the launching app, ending back some custom data enabling the launching app to navigate to a specific (success or failure) view.

The return control to launching app action was performed via a subsequent openURL: call specifying the url of the launching app, with the data to be returned back. This all worked very nicely in iOS8, however in iOS9, we now have the "Back to appName" button in the status bar as the recommended way of returning to the launching app. Unfortunately this does not allow us to return any result data from our app. If we continue to use openURL: to return control back to the launching app in iOS9, this then results in the same status bar button appearing in the launching app "Back to ourApp", which is completely wrong.

So, the question is how do we return control back to the app from where our app was launched with result data in iOS9?

For Deeplinking I used Third party Branch

In AppDelegate this is handled by two UIApplicationDelegate given below

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    NSLog(@"opened app from URL %@", [url description]);
    return [[Branch getInstance] handleDeepLink:url];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {

    BOOL handledByBranch = [[Branch getInstance] continueUserActivity:userActivity];
    return handledByBranch;
}

Reference Link for Deeplinking

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM