user1383060
user1383060

Reputation: 43

Using Universal Links for DeepLinking in Push Notifications on iOS

I am investigating using Universal Links in Push Notifications for Deep Linking into an iOS app. This is so I can future-proof for web. A lot of the examples and tutorials assume the user will select a universal link from a web-site to deep link into an app. I want to use Universal Links in Push Notifications instead of the regular URL Schema approach. I have read the Apple docs https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html

However, I am unclear on at this point if I am just using the Universal Link to open the App via a Push Notification, do I still need to set up all the configurations such as creating and uploading an apple-app-site-association file to the root of the web server.

Is this approach to using Universal Links in Push Notifications to Deep Link into an area of the app a recommended approach since Apple seems to be discouraging the use of URL Schema's in general or are Push Notifications a special case?

Upvotes: 4

Views: 11672

Answers (1)

Mark Thormann
Mark Thormann

Reputation: 2617

Push Notifications and Universal Links are two different animals although they both serve to get the user into the application.

With a Universal Link, Safari on the iOS device is opened first in case the app isn't installed. If the app is present, the user is immediately bounced to the app from Safari with the URL passed to the AppDelegate method application(_:continue:restorationHandler:). If the app isn't present, Safari opens the URL of the Universal Link. Setting up the apple-app-site-association file is necessary here to validate that you own the destination URL in question and can redirect users from the web site to the app instead. Universal Links are better for user-initiated interaction (clicking a link in an email, etc.)

Push notifications on the other hand communicate directly with the device over TCP/IP to pass the message from APNs to the iOS device (see APNs Overview for more info). Safari isn't involved and the user taps the notification on the iOS device (for example) to open the notification and go to the destination. Your destination isn't passed by URL like with Universal/deep links, but with extra JSON in the notification payload that you can process in your app (see Creating the JSON Dictionary for this structure). There is no apple-app-site-association with push notifications as there is no web site involved. You are communicating directly from APNs to your app and using certificates typically to ensure that only you can open your app with a push notification. Remote push notifications are great for developer-initiated interaction to engage the user.

Hope that helps clarify things!

Upvotes: 16

Related Questions