排毒不处理通用链接

问题描述 投票:0回答:1

我一直在尝试使用来自device.openURLhttps://github.com/wix/Detox/blob/master/docs/APIRef.MockingOpenFromURL.md让iOS Universal Links与Detox一起工作,但它不起作用。

我试过的样本:

it('should work', async () => {
  await device.sendToHome();
  await device.openURL({
    url: 'https://name.page.link/somewhere,
    sourceApp: 'com.apple.MobileSMS'
  });
});

它永远不会打开我的应用程序,经过测试各种事情,似乎排毒只支持深层链接而不是通用链接。

我可以提一下,当运行应用程序(在设备和模拟器上)时,通用链接工作正常,这让我相信问题不在于我如何配置通用链接,而是对它进行排毒支持。

在iOS UI测试中,可以通过iMe​​ssage应用程序测试通用链接(请参阅https://blog.branch.io/ui-testing-universal-links-in-xcode-9/)。有人知道排毒的类似解决方法吗?

ios ios-universal-links detox
1个回答
0
投票

您在AppDelegate.m中使用了此代码:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [RCTLinkingManager application:application openURL:url
                  sourceApplication:sourceApplication annotation:annotation];
}

但Detox不支持它。你应该使用:

- (BOOL)application:(UIApplication *)app
        openURL:(NSURL *)url
        options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
  return [RCTLinkingManager application:app openURL:url
                            options:options];
}
© www.soinside.com 2019 - 2024. All rights reserved.