我知道在 Apple 檔案中,他們這樣說:
構建關聯檔案后,將其放在站點的 .well-known 目錄中。檔案的 URL 應符合以下格式:
https:///.well-known/apple-app-site-association 您必須使用 https:// 托管檔案,并使用有效證書且無重定向。
我們的站點不是使用 https,而是使用 http,但是 apple-app-site-association 檔案是使用 https 托管的。這是通過以下方式實作的:
- 使用 letencrypt 和 certbot,它提供了有效的證書
- 一些 nginx 配置,以便一切正常
我不是 DevOps,所以我不知道上面的細節,但是如果我們去 AAA 驗證器(
apple-app-site-association 檔案如下所示:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "com.xxx.MyApp",
"paths": [ "/#/new-password/*", "/#/new-password/"]
}
]
}
}
在開發者門戶中,我啟用了關聯域,在 Xcode 中,關聯域-> 域設定如下所示:
應用鏈接:mysite.dev.com
同樣在 ApplicationDelegate 中,我在 AppDelegate 中實作了 continueUserActivity 方法,但它沒有觸發,當我點擊密碼重置鏈接(來自郵件陷阱)時,我的應用程式沒有打開,而是打開了網路鏈接(網站)。
鏈接具有以下結構:
代碼如下:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
</dict>
- 清理并構建專案并使用 HTTP 協議測驗您的通用鏈接
如果之前的步驟不起作用,您可以嘗試在 Info.plist 中為特定域添加例外:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>mysite.dev.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<false/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSRequiresCertificateTransparency</key>
<false/>
</dict>
</dict>
</dict>
以上只是實驗性的,請記住,如果您的應用沒有充分的理由允許 HTTP 流量,它可能會被 Apple 拒絕,我與您分享一些有趣的鏈接:
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33 https://developer.apple.com/videos /play/wwdc2015/703/ https://github.com/AFNetworking/AFNetworking/issues/2779#issuecomment-112030880
問候!
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/365197.html
