My requirement is to handle universal links on the iOS application. But the dynamic link.url seems to be returning an error as below -
\"@\"error\" : @\"unauth
I was able to get the dynamic link url value. There was an additional check in my code as below -
if (launchOptions != nil)
{
[FIROptions defaultOptions].deepLinkURLScheme = URL_SCHEME;
}
Because of this check, the URL scheme was never getting initialised and hence was erroring out.
The code that i have posted above should return the right dynamic link url.
Thanks.
Try this one.
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler
{
NSURL *url = userActivity.webpageURL;
FIRDynamicLinks *links = [FIRDynamicLinks dynamicLinks];
if([links matchesShortLinkFormat:url])
{
[links resolveShortLink:url completion:^(NSURL * _Nullable url, NSError * _Nullable error)
{
NSString *message =
[NSString stringWithFormat:@"Deep link \n:%@",
url];
[[[UIAlertView alloc] initWithTitle:@"Deep-link Data"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
}];
return YES;
}
return false;
}
I also met this issue. handleUniversalLink()
returned always false. In my case my link parameter contained not just a URL but also parameters. So the final dynamic link got two question marks in it.
https://app-id.app.goo.gl/?link=https://www.domain.com/resource?someParam=someValue&ibi=com.domain.appname
If I escape the inner URL (link parameter) with percent escapes, it works fine.
https://app-id.app.goo.gl/?link=https%3A%2F%2Fwww.domain.com%2Fresource%3FsomeParam%3DsomeValue&ibi=com.domain.appname