CocoaHeads SKG #3 - iOS link Handling

CocoaHeads SKG #3 - iOS link Handling

5a3cfb263fe4968b76c4c0bde721f047?s=128

CocoaHeadsSKG

April 04, 2016
Tweet

Transcript

  1. iOS link handling Dimitri James Tsiflitzis CocoaheadsSKG

  2. Inter-App Communication 1. URL Schemes 2. Universal Links

  3. 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
  4. Registering Custom URL Schemes In your plist If more than

    one third-party app registers to handle the same URL scheme ¯\_(ツ)_/¯
  5. Handling URL Requests E.g. meetup://events/229782259 (scheme://host/path?query)

  6. Check if a URL scheme is available

  7. Preparing for URL Schemes in iOS9 • Add schemes checked

    using canOpenURL to the plist
  8. 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
  9. 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.
  10. 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.
  11. Server side Add a apple-app-site-association to the root of your

    server (prefix can be found in provisioning portal.)
  12. Client Side • Add an entitlement that specifies the domains

    your app supports.
  13. Client side • Update your app delegate to respond appropriately

    when it receives the NSUserActivity object.
  14. 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
  15. Ευχαριστούμε :) @sprimp CocoaheadsSKG