iOS Universal Link Support

A main popurse of this article is to introduce my colleague of server side how to coordinate with iOS universal link feature. So I won't talk too much about client side.

Before iOS 9 if I'd like users jump to my app from other place, I use app scheme that add an "a tag" link on a web page looks like below:

<a href="yourAppScheme://action_you_want_app_act">jump to my app</a>

The shortage of this solution is if someone didn't install my app, click this "a tag" link wil present a error message alert. That's such a bad user experience.

After iOS 9 we can achieve this by universal link, as apple offical document said, two steps is needed:

  • Provide a site which https enabled. and put a file name "apple-app-site-association" to the document root of this site. And the "apple-app-site-association" file should provided by iOS developer, and this file must be sent with the header 'application/pkcs7-mime'.
  • The iOS developer register the specific site to the app, so when user click a link " http://the_specified_site/path?query" from other apps , if this url match the rules in the "apple-app-site-association"file. The system may launch my app. otherwise, the system will open safari to load this url. so, you see, no more error message alert, instead a valid web page shows.

Briefly speaking, server side should provide a https site, and put a "apple-app-site-association" file to the document root which written by a iOS developer, last, send the file with the header 'application/pkcs7-mime', this page may helpful if you don't konw how to add header 'application/pkcs7-mime'.

Occasionally, you may find that click a item of google search results list on iphone, the phone launch an app directly instead of open a web page. how to make this happen?

If any question, feel free to ask.