Handoff and Universal Links failed on iOS 9

对着背影说爱祢 提交于 2019-12-09 13:56:15

问题


I am setting up my apple-app-site-association file follow this tutorial: Handoff works on iOS 8 but handoff does not work on iOS 9. I setup a free hosting site and upload the apple-app-site-association file onto the root of website: universallink.net46.net 1. I created a JSON file and named it handoff.json:

{
    "activitycontinuation": 
    {
        "apps": ["XXXXXXXXXX.com.home.handoff"]
    }, 
    "applinks":
    {
        "apps":[],
        "details":
        {
            "XXXXXXXXXX.com.home.handoff":
            {
                "paths":["*"]
            }
        }
    }
}

The XXXXXXXXXX here is the team id of the Distribution provisioning profile

  1. I used Keychain Access app to export a iPhone Distribution certificate to a Certificates.p12 key.
  2. I signed the JSON file with these commands:

Create a certificate in the openssl command.

openssl pkcs12 -in Certificates.p12 -clcerts -nokeys -out output_crt.pem

Create a secret key.

openssl pkcs12 -in Certificates.p12 -nocerts -nodes -out output_key.pem

Create an intermediate certificate.

openssl pkcs12 -in Certificates.p12 -cacerts -nokeys -out sample.ca-bundle

Sign the handoff.json file with the following command.

cat handoff.json | openssl smime -sign -inkey output_key.pem -signer output_crt.pem -certfile sample.ca-bundle -noattr -nodetach -outform DER> apple-app-site-association
  1. I uploaded the signed file "apple-app-site-association" onto the root of website universallink
  2. I configured the entitlement:
<dict>
  <key>com.apple.developer.associated-domains</key>
  <array>
      <string>activitycontinuation:www.universallink.net46.net</string>
      <string>activitycontinuation:universallink.net46.net</string>
      <string>applinks:www.universallink.net46.net</string>
      <string>applinks:universallink.net46.net</string>
  </array>
</dict>
  1. I implement the function application:continueActivity.... and return YES.
  2. I installed the app on the iOS 9 beta 4 device and also installed the Certificates.p12 at step 3 into the device.
  3. I sent a message to myself the link of universallink website
  4. I expected my app would be launched but actually, it was Safari.

I don't know if I did something wrong.


回答1:


You are signing it wrong. You need a

certificate and key for an identity issued by a certificate authority trusted by iOS

See apples official documentation here: https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/Handoff/AdoptingHandoff/AdoptingHandoff.html#//apple_ref/doc/uid/TP40014338-CH2-SW10




回答2:


I Think This:

 "details":
        {
            "XXXXXXXXXX.com.home.handoff":
            {
                "paths":["*"]
            }
        }

Should be this:

   "details": [{
        "appID": "XXXXXXXXXX.com.home.handoff",
        "paths": ["*"]
     }]



回答3:


I was trying to make it work by using a local server (an OTA https python server) with a self created certificate using SSL and it didn´t work. I could track the communications and listen to the channel but in the different tests I tried, the json file was never asked for, so there is the problem, the SSL certificate. Go to : https://support.apple.com/en-gb/HT205205 as "not all the root certificates" are supported by apple (most of them are though).



来源:https://stackoverflow.com/questions/31604465/handoff-and-universal-links-failed-on-ios-9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!