简体   繁体   English

未安装iOS应用的深层链接?

[英]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 我想使用类似lib的应用程序将深层链接链接到我的应用程序中的特定位置: 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? 如何深度链接到未安装在设备上的应用程序,即,链接指向AppStore,并且在安装该应用程序后应提供一个深层链接令牌?

You could use UIApplications canOpenUrl method to check if the app exists. 您可以使用UIApplications canOpenUrl方法检查应用程序是否存在。

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. 当您单击一个链接将您带到App Store上的某个应用程序页面时,该过程结束,即使您继续安装该应用程序,也不会再调用该应用程序来继续处理启动该过程的链接。

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. 安装链接将是专门用于访问App Store应用程序的链接。

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. 如果您愿意添加额外的Web服务器html / php,则可以使用一个指向网址的链接,该链接用于确定是否安装了该应用程序,在这种情况下,该深层链接被重定向到该地址,或者该应用程序没有被重定向。安装后,页面会将用户重定向到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 我们是在Branch.io上构建的,您可以使用我们的链接,如果您想自己构建这样的服务,则下面的文章提供了所有必要的信息: https : //hackernoon.com/the-death-of-deep-linking- 6cc65eb33e28#.avyz7g5bf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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