[英]Detox does not handle universal links
I've been trying to get iOS Universal Links to work with Detox using device.openURL
from https://github.com/wix/Detox/blob/master/docs/APIRef.MockingOpenFromURL.md but it does not work. 我一直在尝试使用https://github.com/wix/Detox/blob/master/docs/APIRef.MockingOpenFromURL.md上的
device.openURL
使iOS通用链接与Detox一起使用,但是它不起作用。
Sample of what I've tried: 我尝试过的样本:
it('should work', async () => {
await device.sendToHome();
await device.openURL({
url: 'https://name.page.link/somewhere,
sourceApp: 'com.apple.MobileSMS'
});
});
It never opens my app and after testing various things it seems detox only support deep links and not universal links. 它从不打开我的应用程序,并且经过各种测试之后,似乎排毒仅支持深层链接而不支持通用链接。
I can mention that when running the app (both on device and simulator) the universal links work fine which leads me to believe the issue is not with how I have configured universal links but with detox support for it. 我可以提到的是,在运行应用程序(在设备和模拟器上)时,通用链接都可以正常工作,这使我相信问题不在于我如何配置通用链接,而在于对它的排毒支持。
In iOS UI Testing it is doable to test universal links by going through iMessage app (see https://blog.branch.io/ui-testing-universal-links-in-xcode-9/ ). 在iOS UI测试中,可以通过iMessage应用程序测试通用链接(请参阅https://blog.branch.io/ui-testing-universal-links-in-xcode-9/ )。 Anyone know of a similar workaround for detox?
有人知道排毒的类似解决方法吗?
You used this code in AppDelegate.m: 您在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];
}
But it is not supported by Detox. 但排毒不支持。 You should use:
您应该使用:
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
return [RCTLinkingManager application:app openURL:url
options:options];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.