iOS分支深层链接无法在设备上打开应用程序,但在模拟器上效果很好 [英] iOS Branch deep link does not open application on device, but works well on simulator

查看:127
本文介绍了iOS分支深层链接无法在设备上打开应用程序,但在模拟器上效果很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗?
iOS分支深层链接无法在设备上打开应用程序,但在模拟器上效果很好。我的模拟器OS版本是10.3,我的iPhone 5s OS版本是10.3.3



我做了什么:



控制台:设置->链接设置:


  1. 选中始终尝试打开应用

  2. IOS URI方案设置为应用程序的自定义URI方案。

  3. 选中启用通用链接。

  4. 捆绑包标识符&都正确设置了Apple App Prefix。

链接域设置为波纹管:





测试链接的创建如下:





Xcode配置:



1.Associated域





2.Info.plist文件




此处:



我已使用您的App测试了App商店和通用链接按预期工作。我通过Slack,iOS上的默认电子邮件应用程序以及Gmail应用程序共享了链接。在所有三个平台上,单击应用程序的Branch链接均按预期通过Universal链接打开了应用程序。



根据您对测试的描述,您似乎正在禁用Universal链接。 (单击右上角链接的面包屑将禁用通用链接。





要重新启用应用程序的通用链接:
1.将分支链接之一粘贴到新笔记
2.长按链接(注意:如果看到一个弹出预览窗口,您按得太紧)





请注意,这是一个每设备问题,因此,如果您不小心在一部手机上禁用了通用链接,则不会影响



不幸的是,没有办法确保用户不会错误地禁用通用链接。但是,有一线希望,iOS 11之后将不再是问题。有了iOS 11,右上角的面包屑消失了,因此可以禁用通用链接。


Could anybody help me out please? iOS Branch deep link does not open application on device, but works well on simulator. My simulator OS version is 10.3, my iPhone 5s OS version is 10.3.3

What I have done:

Dashboard: Settings -> Link Settings:

  1. "Always try to open app" is checked
  2. "IOS URI Scheme" is set to the application's custom URI scheme.
  3. "Enable Universal Links" is checked.
  4. Bundle Identifier & Apple App Prefix are both set correctly.

Link Domain was set as bellow:

Test Link was created as bellow:

Xcode Configuration:

1.Associated Domains

2.Info.plist file

And, code as bellow:

- (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;
}

What I tested:

  1. I sent the Test Deep Link to my email, and I open the email through Safari. While I click the url on DEVICE, an alert was shown to tell me App Store will be open. While I click the url on SIMULATOR, my app was open successfully.

  2. I pasted the Test Deep Link into Notes on DEVICE, while I click the url, an action sheet was shown and provide two option: open in Safari, Open in xxx(my app name). I click both options, they all could open my app successfully.

Here is all the configuration, code, steps, and I have also tried to change branch_app_domain to applinks:xxxapp.app.link, it didn't work neither.

Is there anything that I missed during the integration procedure? Any suggestion would be very appreciate. Thanks in advance!

Roby

解决方案

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.

这篇关于iOS分支深层链接无法在设备上打开应用程序,但在模拟器上效果很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆