gpt4 book ai didi

ios - 如何设置关联域/通用链接

转载 作者:行者123 更新时间:2023-12-03 23:39:19 25 4
gpt4 key购买 nike

我试图在访问 www.example.com/success 时将用户重定向到已安装的应用程序以及访问主页时显示横幅www.example.com .
在我当前的植入中,url 不会重定向和打开应用程序,网站也不会显示横幅。
我正在关注此处的文档 https://developer.apple.com/documentation/safariservices/supporting_associated_domains
我的网站是一个简单的create-react-app使用 Firebase 托管的主页。
我做了以下事情:

  • 将关联域添加到签名和功能 - applinks:website.com/success
  • 添加 apple-app-site-association文件到/public/
  • 修改firebase.json文件
  • 链接到 index.html 中的文件

  • 我用来验证的内容:
    https://branch.io/resources/aasa-validator/
    https://search.developer.apple.com/appsearch-validation-tool
    通过添加 www.example.com/success 进行测试链接到笔记和打开,它总是在 safari 中打开。我也试过重新安装应用程序并重新启动手机。
    Apple API 验证
    我已将带有关联域的新应用版本上传到商店
    enter image description here
    分支网
    {
    "applinks": {
    "apps": [],
    "details": []
    }
    }
    访问时 www.example.com/apple-app-site-association

    { "activitycontinuation": { "apps": [ "team.com.example.com" ] },"applinks": { "apps": [], "details": [ { "appID":"team.com.example.com", "paths": [ "/", "/", "/success", "/success/",] }, "webcredentials": { "apps": ["team.com.example.com" ] } }


    苹果应用网站协会
    {
    "activitycontinuation": {
    "apps": [
    "team.com.example.com"
    ]
    },
    "applinks": {
    "apps": [],
    "details": [
    {
    "appID": "team.com.example.com",
    "paths": [
    "/",
    "/*",
    "/success",
    "/success/*",
    ]
    },
    ]
    },
    "webcredentials": {
    "apps": [
    "team.com.example.com"
    ]
    }
    }
    索引.html
    <link rel="apple-app-site-association file" href="%PUBLIC_URL%/apple-app-site-association">
    <link rel="apple-app-site-association file" href="/apple-app-site-association">
    <meta name="App" content="app-id=XXX, app-argument=https://apps.apple.com/US/app/APP/idXXX, affiliate- data=optionalAffiliateData">
    Firebase.json
    {
    "hosting": {
    "public": "public",
    "headers": [
    {
    "source": "/apple-app-site-association",
    "headers": [
    {
    "key": "Content-Type",
    "value": "application/json"
    }
    ]
    }
    ],
    "appAssociation": "NONE"
    }
    }
    设备控制台
    安装应用程序时,我通过 swdc 监视 Xcode 中的设备控制台处理与关联域或请求相关的任何内容的日志。这是我找到的一些;

    Error getting enterprise-managed associated domains data. If thisdevice is not enterprise-managed, this is normal: ErrorDomain=SWCErrorDomain Code=1701 "Failed to get associated domain datafrom ManagedConfiguration framework."UserInfo={NSDebugDescription=Failed to get associated domain data fromManagedConfiguration framework., Line=298, Function=}


    Entry { s = applinks, a = , d = au….ub….com, ua = unspecified,sa = approved } needs its JSON updated because the app PI changed


    https://developer.apple.com/library/archive/qa/qa1916/_index.html

    最佳答案

    首先在您的设备日志和 JSON 格式中,您似乎应该遵循此处显示的示例:https://developer.apple.com/documentation/safariservices/supporting_associated_domains
    在您的日志中,它可能会显示来自其他应用程序的日志,这些应用程序也具有过时的 API 格式。但是,这应该不是什么大问题。

    {
    "applinks": {
    "details": [
    {
    "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
    "components": [
    {
    "#": "no_universal_links",
    "exclude": true,
    "comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
    },
    {
    "/": "/buy/*",
    "comment": "Matches any URL whose path starts with /buy/"
    },
    {
    "/": "/help/website/*",
    "exclude": true,
    "comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
    },
    {
    "/": "/help/*",
    "?": { "articleNumber": "????" },
    "comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
    }
    ]
    }
    ]
    },
    "webcredentials": {
    "apps": [ "ABCDE12345.com.example.app" ]
    },
    "appclips": {
    "apps": ["ABCED12345.com.example.MyApp.Clip"]
    }
    }
    其次按照Apple的故障排除步骤和你的问题我猜你的问题可能是第7步
  • 您的应用从以下任一情况返回 false
    UIApplicationDelegate 协议(protocol)方法:
    应用程序(:继续用户事件:恢复处理程序:),
    应用程序(:willFinishLaunchingWithOptions:),
    应用程序(_:didFInishLaunchingWithOptions:)。
    如果您可能会发生这种情况
    解析了传递给这些方法的 URL,并且您实现了
    逻辑来确定您的应用程序不能使用此 URL。

  • 您尚未发布如何处理 URL。您需要执行 UIUserActivityRestoring其他答案中建议的方法使其起作用。这是一个 SwiftUI 版本
    ContentView()   
    .onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { userActivity in

    print("Continue activity \(userActivity)")
    guard let url = userActivity.webpageURL else {
    return
    }

    print("User wants to open URL: \(url)")
    // TODO same handling as done in onOpenURL()

    }
    还添加
    .onOpenURL { url in
    print("URL OPENED")
    print(url) // parse the url to get someAction to determine what the app needs do
    if url.relativeString == "example://success" {

    }
    }
    https://developer.apple.com/library/archive/qa/qa1916/_index.html

    关于ios - 如何设置关联域/通用链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66871656/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com