简体   繁体   English

iOS 通用链接:点击应用程序内的通用链接会将我重定向到 safari 而不是继续在应用程序中

[英]iOS Universal links : Tapping universal link inside the Application redirects me to safari instead of continuing in the application

I am using third party SDK which internally calls UIApplication.shared.OpenUrl to open a universal link within the application.我正在使用third party SDK内部调用UIApplication.shared.OpenUrl来打开应用程序中的通用链接。

But instead of getting call-back in application:(UIApplication *)application continueUserActivity the link is opened in Safari.但不是在application:(UIApplication *)application continueUserActivity中获得回调,而是在 Safari 中打开链接。

I want to continue handling the Universal link within the application, rather than move to Safari.我想继续处理应用程序中的通用链接,而不是移动到 Safari。

Note: I cannot use Custom URL scheme due to project restrictions.注意:由于项目限制,我不能使用自定义 URL 方案。 When I use iPhone Notes application that universal link;当我使用通用链接的 iPhone Notes 应用程序时; tapping on the link opens my application.点击链接打开我的应用程序。

https://frozen-garden-86689.herokuapp.com/apple-app-site-association https://frozen-garden-86689.herokuapp.com/apple-app-site-association

You have to add associated domains in your app and upload a file on your website on this path您必须在您的应用程序中添加关联的域,并在您的网站上在此路径上上传文件

https://yourwebsite.com/.well-known/apple-app-site-association

in apple-app-site-association you have to add exact this JSON在 apple-app-site-association 中,您必须准确添加此 JSON

{
    "applinks": {
        "apps": [],
        "details": [{
            "appID": "xxxxxx", // your appID here like 2u19IxOp1.com.mybudleid.app
            "paths": ["/g/*"] //it should be same
        }]
    }
}

after putting exact JSON on the path, hit the path on the browser it should show this JSON file将确切的 JSON 放在路径上后,点击浏览器上的路径,它应该会显示这个 JSON 文件

important!* and must add the associated domain in your Xcode project which will be applinks:yourwebsite.com重要!*并且必须在您的 Xcode 项目中添加相关域,该项目将是applinks:yourwebsite.com

and here your links will start redirecting to your app instead of safari在这里您的链接将开始重定向到您的应用程序而不是 safari

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

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