[英]Application not handle <Universal Links>
I have some trouble with universal links, and I can't understand why my app not handle Universal Link.我在使用通用链接时遇到了一些问题,我不明白为什么我的应用不能处理通用链接。 Application based on SwiftUI but I use UIkit for developing
基于 SwiftUI 的应用程序,但我使用 UIkit 进行开发
@main
struct iOSApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
WrapperUIVC_Hello().edgesIgnoringSafeArea(.all)
.onOpenURL { url in
// don't work
print("Universal link \(url)")
}
}
}
}
and this code also don't work而且这段代码也不起作用
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, let url = userActivity.webpageURL, let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else {
print("Universal Link trouble")
return false
}
for queryItem in components.queryItems ?? [] {
print("Universal link components \(queryItem)")
}
return true
}
also inside entitlements, I use:在权利中,我使用:
applinks:example.com
webcredentials:example.com
My file is hosted like "example.com/.well-known/apple-app-site-association & example.com/apple-app-site-association:我的文件托管为“example.com/.well-known/apple-app-site-association & example.com/apple-app-site-association:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "U678YHJU89.com.example",
"components": [
{
"#": "society/lettings"
},
{
"#": "society/lettings/*"
},
{
"#": "society/acquisitions"
},
{
"#": "society/acquisitions/*"
}
]
}
]
},
"webcredentials": {
"apps": [
"U678YHJU89.com.example"
]
}
}
For testing my file I use: https://branch.io/resources/aasa-validator/#resultsbox And all tests was passed -为了测试我的文件,我使用: https://branch.io/resources/aasa-validator/#resultsbox所有测试都通过了 -
"This domain validates, JSON format is valid, and the Bundle and Apple App Prefixes match (if provided).
Below you’ll find a list of tests that were run and a copy of your apple-app-site-association file:"
Also I use https://search.developer.apple.com/appsearch-validation-tool : Apple say to me another msg我也使用https://search.developer.apple.com/appsearch-validation-tool :苹果对我说另一个味精
Action required
Could not extract required information for application links. Learn how to implement the recommended Universal Links.
Error cannot parse app site association
But I check syntax all look well, also I use additional web tools, and can say that route to AASA not have redirection and status code 200但我检查语法一切看起来都很好,我还使用了额外的 web 工具,可以说到 AASA 的路由没有重定向和状态码 200
Also I tried user modification like ?mode=developer etc. but in my case it did not worked.我也尝试过像?mode=developer等用户修改,但在我的情况下它没有用。 I did all testing functionality locally in mode.
我在本地模式下完成了所有测试功能。
If I use command in CMD(for.well-known & and without) - curl -v 'example.com/.well-known/apple-app-site-association ' all look well如果我在 CMD(for.well-known & and without) 中使用命令- curl -v 'example.com/.well-known/apple-app-site-association ' 一切看起来都很好
* Connected to example.com (myip) port 80 (#0)
> GET /.well-known/apple-app-site-association HTTP/1.1
> Host: example.com
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.18.0
< Date: Tue, 09 Aug 2022 17:24:18 GMT
< Content-Type: text/html
< Content-Length: 169
< Connection: keep-alive
< Location: https://example.com/.well-known/apple-app-site-association
<
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>
* Connection #0 to host example.com left intact
if I use command - curl -v 'https://example.com/.well-known/apple-app-site-association , content type will next如果我使用命令- curl -v 'https://example.com/.well-known/apple-app-site-association ,接下来是内容类型
content-type: application/json
Where do I have mistakes, and what I can use for additional debugging?我在哪里有错误,我可以用什么来进行额外的调试?
I used old standard of syntax for AASA file, thank you Stephen Schlecht for observing我对 AASA 文件使用了旧的语法标准,感谢Stephen Schlecht的观察
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.