简体   繁体   中英

Deep Linking for iOS Apps which are not installed yet?

I want to use deep linking to a specific place in my app using a lib like: https://github.com/usebutton/ios-deeplink-sdk

I know how to make deep linking when the app is installed on the device.

How can I deep link to an app which is not installed on the device, ie, a link refers to the AppStore and after installing the app a deep link token should be present?

You could use UIApplications canOpenUrl method to check if the app exists.

See example:

-(void)openOtherApp
{
    UIApplication * myApplication = UIApplication.sharedApplication;
    NSString * URLEncodedString = [@"someSortOfAction" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString * completePath = [@"otherAppsUrlScheme://" stringByAppendingString:URLEncodedString];
    NSURL * theUrl = [NSURL URLWithString:completePath];
    if ([myApplication canOpenURL:theUrl])
    {
        // App is installed, launch it
        [myApplication openURL:theUrl];
    }
    else
    {
        // App not installed open app store
        // replace appstore web url http:// with itms-apps:// or itms://
        NSURL * AppStoreURL = [NSURL URLWithString:@"itms-apps://appstoreurl"];
        [myApplication openURL:AppStoreURL];
    }
}

When you follow a link that gets you to an app's page on the App Store, the process ends and even if you continue on to install the app, the app will no longer get called to continue processing the link that initiated the process.

Also, the link to install the app is not going to be the same as a deep-link used to provide an app with data. The install link will be one specifically to get to the App Store app.

Currently, the only way to do what you want is to provide two links, one for install and one for deep-linking into the app once it is installed. You can put these two links in an email, a text message, a web page, etc.

If you are willing to add extra web server html/php, you can use one link to a web address, that is used to determine if the app is installed, in which case the deep link is redirected to, or if the app is not installed, the page redirects the user to the App Store. However, the install scenario requires the user to return after the install and tap on the link again in order to have the deep-link acted upon. One link, two taps.

You can set up a hosted link service that does that and handles all the different deep link standards for each specific platform and use case and that is able to pass parameters through install. We built this at Branch.io and you can use our links and the article below has all the info necessary if you want to build such a service yourself: https://hackernoon.com/the-death-of-deep-linking-6cc65eb33e28#.avyz7g5bf

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