Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CocoaHeads SKG #3 - iOS link Handling

CocoaHeads SKG #3 - iOS link Handling


April 04, 2016

More Decks by CocoaHeadsSKG

Other Decks in Technology


  1. Using URL Schemes to Communicate with Apps • Easy to

    setup & define • Even easier to use • Available in older iOS versions with some limitations on iOS9
  2. Registering Custom URL Schemes In your plist If more than

    one third-party app registers to handle the same URL scheme ¯\_(ツ)_/¯
  3. Some extra stuff • Visit http://handleopenurl.com/ to get a list

    of schemes • Use custom URL schemes to have a Today Extension communicate with your app
  4. Using Universal Links (from the docs) • Unique. Unlike custom

    URL schemes, universal links can’t be claimed by other apps, because they use standard HTTP or HTTPS links to your website. • Secure. When users install your app, iOS checks a file that you’ve uploaded to your web server to make sure that your website allows your app to open URLs on its behalf. Only you can create and upload this file, so the association of your website with your app is secure. • Flexible. Universal links work even when your app is not installed. When your app isn’t installed, tapping a link to your website opens the content in Safari, as users expect. • Simple. One URL works for both your website and your app. • Private. Other apps can communicate with your app without needing to know whether your app is installed.
  5. Adding support for Universal links • Create an apple-app-site-association file

    that contains JSON data about the URLs that your app can handle. • Upload the apple-app-site-association file to your HTTPS web server. • Prepare your app to handle universal links.
  6. Server side Add a apple-app-site-association to the root of your

    server (prefix can be found in provisioning portal.)
  7. Client side • Update your app delegate to respond appropriately

    when it receives the NSUserActivity object.
  8. Some extra stuff • Work in SFSafariViewController, don’t work in

    UIWebView • Debugging the apple-app-site-association is hard • Some popular app don’t support them, e.g. gmail • Actions are remembered