Calabash-iOS是否支持深层链接?

时间:2022-11-27 19:58:55

I would like to know if calabash supports deep linking, I need to access a section of my native app through a link. If it does support it, could you refer some example?

我想知道如果calabash支持深层链接,我需要通过链接访问我的原生应用程序的一部分。如果确实支持它,你可以参考一些例子吗?

Thanks.

1 个解决方案

#1


0  

Calabash does not support that type of operation directly.

Calabash不直接支持这种类型的操作。

What you can do, however, is create a backdoor method which triggers the same functionality.

但是,您可以创建一个后门方法来触发相同的功能。

E.g., suppose when your app is opened via URL myapp://?key=value, you are handling the necessary logic in AppDelegate.m with a function called

例如,假设当您的应用程序通过URL myapp://?key = value打开时,您正在使用名为AppDelegate.m的函数处理必要的逻辑

- (void)handleOpeningAppWithURL:(NSURL *)url { 
    /* parse url, etc...*/
}

Then you could have a backdoor method in your app delegate, say:

然后你可以在你的app委托中有一个后门方法,比如说:

- (NSString *)backdoorOpenWithURLString:(NSString *)urlString {
    [self handleOpeningAppWithURL:[NSURL urlFromString:urlString]];
    return nil;
}

And invoke it from calabash via:

并通过以下方式从calabash调用它:

backdoor "backdoorOpenWithURLString:", "myapp://?key=value"

#1


0  

Calabash does not support that type of operation directly.

Calabash不直接支持这种类型的操作。

What you can do, however, is create a backdoor method which triggers the same functionality.

但是,您可以创建一个后门方法来触发相同的功能。

E.g., suppose when your app is opened via URL myapp://?key=value, you are handling the necessary logic in AppDelegate.m with a function called

例如,假设当您的应用程序通过URL myapp://?key = value打开时,您正在使用名为AppDelegate.m的函数处理必要的逻辑

- (void)handleOpeningAppWithURL:(NSURL *)url { 
    /* parse url, etc...*/
}

Then you could have a backdoor method in your app delegate, say:

然后你可以在你的app委托中有一个后门方法,比如说:

- (NSString *)backdoorOpenWithURLString:(NSString *)urlString {
    [self handleOpeningAppWithURL:[NSURL urlFromString:urlString]];
    return nil;
}

And invoke it from calabash via:

并通过以下方式从calabash调用它:

backdoor "backdoorOpenWithURLString:", "myapp://?key=value"