Soumya Sahu
Soumya Sahu

Reputation: 113

Firebase dynamic short link in ios returns null but long dynamic link works

I followed the dynamic link for ios video and tutorials. After everything is setup, when I click on the dynamic link https://a75xd.app.goo.gl/2rkG , I get null in the completion method of the handleUniversalLink:userActivity.webpageURL.

But when I use the full URL as found in link details in firebase console, I get the link parameters perfectly.

https://a75xd.app.goo.gl/?link=http://onesnaps.com&isi=999758235&ibi=com.onesnaps&ius=osScheme&utm_source=google&utm_medium=cpc&utm_campaign=spring

Upvotes: 3

Views: 2146

Answers (2)

Ala'a AbuNemeh
Ala'a AbuNemeh

Reputation: 149

i faced this issue and resolve it by the following steps

1- delete the app

2- open the dynamic link from massages or email or note

3- the dynamic link should be go to the app store

4- go to Xcode and rebuild the app

5- reopen the dynamic link and the dynamicLinks.url will return value

Upvotes: 3

Aklesh Rathaur
Aklesh Rathaur

Reputation: 1847

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;
}

Upvotes: -1

Related Questions