Desktop Safari to iOS native app Handoff opens iOS Safari

问题内容:

I try to implement Web-to-Native handoff for my iOS app. I uploaded my apple-app-site-association file and it seems OK:

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "XXXXXX.com.myapp",
                "paths": [ "/*" ]
            }
        ]
    },
    "webcredentials": {
       "apps": [ "XXXXXX.com.myapp" ]
    },
    "activitycontinuation": {
        "apps": [ "XXXXXX.com.myapp" ]
    }
}

Universal links and web credentials both work just fine, but Handoff doesn’t. When I open my URL in Safari on macOS, my iOS device shows handoff for Safari, not for my app. I double-checked my code, I do have all entries in entitlements, like

activitycontinuation:alpha.mysite.com

I also tried

activitycontinuation:*.mysite.com
activitycontinuation:mysite.com

I implemented -application:continueUserActivity:restorationHandler: method, and even added these lines in my plist:

<key>NSUserActivityTypes</key>
<array>
    <string>NSUserActivityTypeBrowsingWeb</string>
</array> 

But iOS still shows Safari in handoff, not my app.

This is what I found in device console log:

Dec  8 19:30:04 iPad-Valentine-2 swcd(CoreUtils)[255] <Notice>: Trying add of app ID 'XXXXXX.com.myapp' for get info
Dec  8 19:30:04 iPad-Valentine-2 swcd(CoreUtils)[255] <Notice>: ### Add service '<<NULL>>', app ID 'XXXXXX.com.myapp', domain '<<NULL>>' failed: -6727/0xFFFFE5B9 kNotFoundErr

But I can’t find out what does that mean.

问题评论:

    
Have you tried deleting app completely and retrying? Sounds stupid but it will clear the cache that says hand off for ‘x.x.x’ links should be handled on safari and iOS will rescrape the domain for apple-app-site file and hopefully be handled by app.
    
I tried reinstalling, but it didn’t help. I also tried installing the app on a completely new device.
– silvansky
7 hours ago

原文地址:

https://stackoverflow.com/questions/47719231/desktop-safari-to-ios-native-app-handoff-opens-ios-safari

添加评论

友情链接:蝴蝶教程