Former iOS Deeplink
Important Note ✅:
We strongly recommend referring to the updated SDK on Swift SDK Integration for incorporating Netmera into your projects. The previous iOS method, which you can find here, is being phased out and will not be supported in the long term. Transitioning to the new SDK will ensure that you have access to the latest features, improvements, and technical support.
Deep Linking
When sending a push notification with custom action buttons, you can redirect users to any custom page or view in your app by specifying deep links as custom action button URLs. To achieve this, you first need to create a URL scheme (netmera://
) in your project.
Using Xcode, edit your Info.plist file:
Add a new key, "URL types." Xcode will automatically make this an array containing a dictionary called "Item 0."
Within "Item 0," add a key, "URL identifier," and set the value to your custom scheme.
Within "Item 0," add a key, "URL Schemes." This will automatically be an array containing a string called "Item 0."
Set "URL Schemes » Item 0" to your custom scheme.
Once you've completed these steps, you can confirm that your new URL scheme has been added to your app's Info.plist file. It should look like this:
After setting up the URL scheme, you should add the application:openURL:options:
method to your app delegate.
In this method, you can check the passed URL for custom view navigation using the scheme
and host
properties. For example, if you've set the custom action button URLs as netmera://screenOne
and netmera://screenTwo
, you can use something similar to this snippet.
Deeplink Callback
The Netmera SDK will trigger the openURL
method when users click on the notifications received by their devices. If your application integrates multiple SDKs, there might be situations where the openURL
method is not called due to potential override issues. To address this, you can manage deep linking effectively using the Netmera Delegate and these methods.
Universal Links
Configure the Project
Add the "Associated Domains" capability to the project.
In the domain section, add an entry for each domain that the app supports, prefixed with
applinks:
, such asapplinks:www.mywebsite.com
.
Configure the Website
Create an
apple-app-site-association
file with the appID and the paths the app supports (e.g.,naturalworld.com/products
). The format matches that of a JSON file, but it cannot have the .json extension.The appID consists of the team ID (found in the Apple Developer Account in the membership section) combined with the app’s bundle ID (found in the project).
Specify the paths the app will support.
Host your
apple-app-site-association
file on your domain. It should be uploaded to your HTTPS web server. You can place the file at the root of your server or in the ".well-known" subdirectory.
Handle URL
To use Universal Links, ensure you have added a registered domain to your app’s capabilities and have uploaded an apple-app-site-association
file. Then, implement the method application:continueUserActivity:restorationHandler:
in your AppDelegate. For example:
When using the userActivity
methods to handle Universal Links, the user will be prompted with the question "Open in Safari or in the application?" when clicking on the notification. However, if you handle Universal Links with Netmera Delegate methods (shouldHandleOpenUrl
and handleOpenUrl
), the user will be directed straight to the app. You can find more information about Netmera Delegate methods, specifically shouldHandleOpenUrl
and handleOpenUrl
, in the documentation here.
Last updated