简体   繁体   中英

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

@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:

{
    "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 -

"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

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

Also I tried user modification like ?mode=developer etc. but in my case it did not worked. 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

* 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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