简体   繁体   English

如何制作指向指定页面的通用链接 go

[英]How to make universal links go to specified pages

First, I want to make it clear that I am not an objective-c developper, and normally only use a mac to update the app we are working on.首先声明一下,我不是objective-c开发者,平时只用mac来更新我们正在开发的app。 (I am using cordova so no programming on the IOS side) (我正在使用 cordova,所以 IOS 端没有编程)

I have been trying to implement universal links between other chores for months, and I am stuck, something fierce.几个月来,我一直在尝试在其他杂务之间实现通用链接,但我被卡住了,非常激烈。

I followed every tutorial on the subject.我遵循了有关该主题的所有教程。 One of them, https://medium.com/wolox/ios-deep-linking-url-scheme-vs-universal-links-50abd3802f97 for example.其中之一,例如https://medium.com/wolox/ios-deep-linking-url-scheme-vs-universal-links-50abd3802f97

But in a lot of them, I have to "handle url".但是在很多情况下,我必须“处理 url”。 Okay, but what do I do with it?好吧,但我该怎么办呢? What shall I do with my received URL?我应该如何处理我收到的 URL? most tutorials are in swift and I use Objective-C and I just dont know what to do, what to write in my AppDelegate file.大多数教程都在 swift 中,我使用 Objective-C,我只是不知道该做什么,在我的 AppDelegate 文件中写什么。

Here is my AASA file这是我的 AASA 文件

{
"applinks": {
    "apps": [],
    "details": [
        {
            "appID": "myteamid.mybundle",
            "paths": [ "*"]
        }
    ]
},
"webcredentials": {
    "apps": [ "myteamid.mybundle" ]
},
"appclips": {
    "apps": ["myteamid.mybundle"]
}

} }

Option is activated, and then, the appdelegate file选项被激活,然后,appdelegate文件

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{

if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb]) {

    NSURL *url = userActivity.webpageURL;
    // usually, this comment in tutorials is saying "handle url"

}

return YES;

} }

with this, I can indeed open the app.有了这个,我确实可以打开应用程序。 But it's the main page, and I can't be taken into the page I need to go to.但是是主页面,无法进入我需要go到的页面。 Foe example, I will be taken to mysite.com, when I want to go to mysite.com/help.例如,当我想 go 到 mysite.com/help 时,我会被带到 mysite.com。

I read about components of the url. But I don't know how to handle them as I only saw examples in swift and haven't managed to adapt them.我阅读了 url 的组件。但我不知道如何处理它们,因为我只在 swift 中看到示例并且没有设法适应它们。

This is an example of course.这当然是一个例子。

Can someone help me?有人能帮我吗?

The AASA file only defines if your app should open based on the components (or path ) you defined. AASA 文件仅定义的应用程序是否应根据您定义的components (或path )打开。 Since not every feature might be available in your app, but is available on your website, you might still want to let users be presented with you website, instead of your app.由于并非所有功能都可以在您的应用程序中使用,但可以在您的网站上使用,因此您可能仍希望让用户看到您的网站,而不是您的应用程序。

How a deep link opens in your app is not part of the AASA file.深层链接在您的应用程序中的打开方式不是 AASA 文件的一部分。 You need to implement the handling of the link in your app.您需要在您的应用程序中实现对链接的处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM