我做了什么:
信息中心:设置 - >链接设置:
Link Domain设置如下:
测试链接创建如下:
Xcode配置:
1.Associated Domains
2.Info.plist文件
并且代码如下:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
[[Branch getInstance] handleDeepLink:url];
BOOL success = NO;
success = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
if (!success) {
success = [router handleURL:url withCompletion:nil];
}
//force return YES
return YES;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
BOOL ret = NO;
ret = [[Branch getInstance] continueUserActivity:userActivity];
if (!ret) {
ret = [router handleUserActivity:userActivity withCompletion:NULL];
}
//force return YES
return YES;
}
我测试了什么:
我将Test Deep Link发送到我的电子邮箱,然后通过Safari打开电子邮件。当我点击DEVICE上的网址时,会显示一条警告,告诉我App Store将会打开。当我点击SIMULATOR上的网址时,我的应用程序已成功打开。
我将Test Deep Link粘贴到DEVICE上的Notes中,当我点击url时,会显示一个操作表并提供两个选项:在Safari中打开,在xxx中打开(我的应用程序名称)。我点击了这两个选项,他们都可以成功打开我的应用程序。
以下是所有配置,代码和步骤,我也尝试将branch_app_domain更改为applinks:xxxapp.app.link,它既不能正常工作。
在整合过程中是否有任何遗漏?任何建议都会非常感激。提前谢谢!
拉吉
答案 0 :(得分:2)
Amruta from Branch.io here:
I tested with your App available on the App Store and Universal links work as expected. I shared the link via Slack, the default Email App on iOS as well as the Gmail app. On all three platforms clicking on the Branch link for your App opened your App via Universal links as expected.
Based on your description of testing it looks like you are disabling Universal links (clicking the breadcrumb on the top right link disables Universal links.
To re-enable Universal Links for an app: 1. Paste one of your Branch links into a new note 2. Perform a long press on the link (note: if you see a "preview" window pop open, you are pressing too hard)
Note that this is a 'per-device' issue, so if you accidentally disable Universal Links on one phone, it won't affect other users.
Unfortunately, there is no way to ensure that a user does not disable Universal links by mistake. However, there is a silver lining, this will no longer be an issue post iOS 11. With iOS 11 the breadcrumb in the top right corner has disappeared and so has the ability to disable Universal Links.