'How to make universal links go to specified pages
First, I want to make it clear that I am not an objective-c developper, and normally only use a mac to update the app we are working on. (I am using cordova so no programming on the IOS side)
I have been trying to implement universal links between other chores for months, and I am stuck, something fierce.
I followed every tutorial on the subject. One of them, https://medium.com/wolox/ios-deep-linking-url-scheme-vs-universal-links-50abd3802f97 for example.
But in a lot of them, I have to "handle url". Okay, but what do I do with it? What shall I do with my received URL? most tutorials are in swift and I use Objective-C and I just dont know what to do, what to write in my AppDelegate file.
Here is my AASA file
{
"applinks": {
"apps": [],
"details": [
{
"appID": "myteamid.mybundle",
"paths": [ "*"]
}
]
},
"webcredentials": {
"apps": [ "myteamid.mybundle" ]
},
"appclips": {
"apps": ["myteamid.mybundle"]
}
}
Option is activated, and then, the appdelegate file
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{
if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb]) {
NSURL *url = userActivity.webpageURL;
// usually, this comment in tutorials is saying "handle url"
}
return YES;
}
with this, I can indeed open the app. But it's the main page, and I can't be taken into the page I need to go to. Foe example, I will be taken to mysite.com, when I want to go to mysite.com/help.
I read about components of the url. But I don't know how to handle them as I only saw examples in swift and haven't managed to adapt them.
This is an example of course.
Can someone help me?
Solution 1:[1]
The AASA file only defines if your app should open based on the components
(or path
) you defined. Since not every feature might be available in your app, but is available on your website, you might still want to let users be presented with you website, instead of your app.
How a deep link opens in your app is not part of the AASA file. You need to implement the handling of the link in your app.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | cigien |