[英]iOS applink not working on the device but opens app on simulator
I tried to follow as many as suggestions as possible but could not get it to work on my app which is still in development (not in appstore yet).我尝试尽可能多地遵循建议,但无法让它在我仍在开发中的应用程序上运行(尚未在 appstore 中)。 Here are the details:
以下是详细信息:
Only testing in iOS 14 for now.目前仅在 iOS 14 中进行测试。
Following JSON file "apple-app-site-association" stored both under Wordpress web root as well as under.well-known/在 Wordpress web root 和 under.well-known/
{
"applinks": {
"apps": [],
"details": [
{
"appID": "XXXXXXXXXX.com.xxx.myapp",
"paths": [
"item/*"
]
}
]
}
}
Forcing MIME type with .htaccess使用 .htaccess 强制 MIME 类型
<Files apple-app-site-association>
ForceType application/json
</Files>
curl -v
to https://mydomain/.well-known/apple-app-site-association returns content with right mime type application/json
and status code 200. curl -v
到 https://mydomain/.well-known/apple-app-site-association 返回具有正确 mime 类型application/json
和状态码 200 的内容。
Here is the .entitlements
file:这是
.entitlements
文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:www.myapp.com</string>
<string>applinks:www.myapp.com?mode=developer</string>
</array>
</dict>
</plist>
Enabled Associated Domains Debugging
in Settings -> Developer menu.在设置 -> 开发人员菜单中启用
Associated Domains Debugging
。
Added Associated Domains
capability in the developer.apple.com portal.在 developer.apple.com 门户中添加了
Associated Domains
功能。
Verified OK with https://branch.io/resources/aasa-validator/使用https://branch.io/resources/aasa-validator/验证正常
Implemented the delegate methods but not invoked实现了委托方法但未调用
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
print("Opening app thru applink")
// ....
return true
}
Server access logs have this line which indicates either Apple Bot or the device accessed it服务器访问日志有这一行,表示 Apple Bot 或访问它的设备
00.000.00.00 - - [04/Mar/2021:23:05:19 -0700] "GET /.well-known/apple-app-site-association HTTP/1.1" 200 133 "-" "swcd (unknown version) CFNetwork/1220.1 Darwin/20.3.0" **0/507**
Not seeing and swcd
errors in device logs related to this.在与此相关的设备日志中看不到和
swcd
错误。
Tried both debug and release builds.尝试了调试和发布版本。
Anything else I can do to troubleshoot?我还能做些什么来解决问题?
Finally figured out.终于想通了。 Was missing couple of things:
缺少几件事:
"/item/*"
"/item/*"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.