10 Replies
      Latest reply on Sep 1, 2015 8:35 PM by iccir
      slutsker Level 1 Level 1 (0 points)

        We have tried both a signed and unsigned apple-app-site-association file (hosted on an HTTPS server, of course.) The file appears syntactically valid (we get an error message when it's not) but the app never gets opened when trying from Safari, Messenger, etc.

         

        The file is simply:

         

        {
          "applinks": {
          "apps": [],
             "details": {
                "<TEAM_ID>.com.myapp": { 
                      "paths": [ "*" ] 
                 }
              }
          }
        }
        

         

        Does anyone have a working example of Universal Links? If so, could you share your JSON file and how you triggered the link (was it from Safari? Messenger?) We can't seem to get anything to work.

        • Re: Has anyone gotten Universal Links to work in iOS 9 Beta 5?
          gracion Level 1 Level 1 (0 points)

          No success here either (SEE UPDATE BELOW). We've updated two iOS apps, gotten Core Spotlight indexing working on the device, but what should be universal links (in Safari or messages)  open in Safari and our app is not launched or called.

           

          Two things that seem unclear:

           

          1. What label should be used in the app's com.apple.developer.associated-domain entitlement (as set in Capabilities)? Autofill and the handoff doc use "webcredentials:", but mentions of this on the forum use "applinks:" like the server json file. That doc doesn't say.

           

          2. If the device's on-install reading of the json file is successful, does it print anything in console? I've read that errors are logged to console, but I don't see anything that looks relevant.

           

          UPDATE:

          I had success with a fresh start with a new app and site. Now I just have to figure out why our real app and site don't work.

           

          On my test site (which serves http and https from the same folder) I did NOT sign the JSON file ( apple-app-site-association). In my test app (created from scratch with Xcode 7 beta), I added the associated domain entitlements (like applinks:www.aiiee.com) to the app and put the application:continueUserActivity:restorationHandler: method in the app delegate.

           

          @slutsker, your JSON file looks just like mine. The only difference is the path "*" is on a separate line, and the ] after it is on a separate line, more like the example, but I don't think that matters.

           

          I triggered the universal link by adding it to a Contact, so I could just tap it in the Contacts app on the device for testing.

           

          I also tried going to the home page of the site in Mobile Safari, which was interesting: if I go to the site via https (which just opens the page without leaving Safari), tapping any internal link on the page opens my app. But if I go to the site via http, links stay in Safari. In other apps, it doesn't matter if a URL is http or https, both work the same and open my app.

           

          I'm doing the minimum required per the newer doc: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1

           

          The above was with beta 5. I still haven't seen anything relevant in the device console, although I haven't looked very hard.

           

          P.S. Unsurprisingly, the same app did not work in the iOS 9 simulator.

            • Re: Has anyone gotten Universal Links to work in iOS 9 Beta 5?
              slutsker Level 1 Level 1 (0 points)

              Thanks for your help.

               

              We got it working today, and it was a rather tricky issue. Basically, we figured out that the root domain was not working (http://example.com) but paths like http://example.com/whatever work. This JSON file covered all paths and worked:

               

              { "applinks": {
                   "apps": [], 
                   "details": {
                        "<app_id>.stuff":{
                             "paths": [ "*", "/" ]
                        }
                   }
                } 
              }
              
              • Re: Has anyone gotten Universal Links to work in iOS 9 Beta 5?
                rwforsythe Level 1 Level 1 (0 points)

                This was very helpful. I now have Universal Links working -- with a twist.

                 

                1) I created the apple-app-site-association file as instructed here. The JSON file has "applinks:" in it.

                2) I signed the file as instructed here and placed it to be found on our home page. (Note: my cert is a *.domain.com cert...)

                3) I added the Associated Domains Entitlement as instructed in the first link, using "applinks:xxx.com" and "applinks:www.xxx.com".

                 

                That's it. When in iOS 9 I visit a web page listed in my site-association file (either http: or https: www.xyz.com or xyz.com) it pops a small banner at the top of the page saying "Open in the NoteStream app" and a big OPEN button. If I hit that button, it calls application:continueUserActivity:restorationHandler: method. This is NOT the familiar smart banner -- it looks different.

                 

                I have to say that I thought it would automatically pop into the app... But it doesn't. In fact, this overrides my web pages auto-redirect feature implemented in javascript that DOES auto-load the app if installed. I guess Apple want to give the user the option to switch into the app.

                 

                Final note: this works just the same if the app is compiled on Xcode 6.x and runs on iOS 9. You DON'T need Xcode 7 to implement this feature.

                 

                Second note: Typically, Safari shows the banner described above. But sometimes I have had the app auto-launch from a Universal Link on the web page into the app. Not sure why; either Safari is trying to guess my preference somehow, or iOS 9 is buggy...

                 

                Third note: This doesn't work on the iOS 9 simulator.

                 

                Fourth note: I notice that the current deep link handler (application:openURL:sourceApplication:annotation:) is deprecated in iOS 9... So this is the new deep link...

              • Re: Has anyone gotten Universal Links to work in iOS 9 Beta 5?
                rocir Level 1 Level 1 (0 points)

                Were you able to make it work on Xcode 7 beta 6?