2

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" : @"unauthorized user: username=social-app-invite methodName=/FirebaseLookupService.LookupAppsSummary protocol=loas securityLevel=integritY"

When i click on a dynamic link (https://****.app.goo.gl/****) from the notes app, my ios app will be directed to the following callback -> In this function i have the following code -

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler
{
NSURL *incomingURL = userActivity.webpageURL;
if(incomingURL){
    BOOL handled = [[FIRDynamicLinks dynamicLinks]
                    handleUniversalLink:incomingURL
                    completion:^(FIRDynamicLink * _Nullable dynamicLink,
                                 NSError * _Nullable error) {
                        if (dynamicLink.url){`
                           **HANDLE THE DYNAMIC LINK HERE**
                        }else{
                           **CODE IS RETURNING ERROR** NSLog(@"error %@",error);
                        }
                    }];
    return handled;
}else{
    return false;
}

}

I have followed the firebase documentation correctly. Please suggest what is going wrong here?

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

I am trying to get an dynamic link , but handleuniversallink() always returns false and also not entered into the closure.
0

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

26 Comments

I tried this, am getting myappid://google/link/ not the long dynamic link, any reason why its not returning dynamic link url. Thanks
You can get long dynamic link in block url, what i formated in "message" string.
I can get my long dynamic link in block section.
Try to put same code as my answer without any change.
Thanks for your input, Aklesh. But I am getting null for "url". Instead get an error for NSError.
|
0

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.

1 Comment

thanks for the message. But this one is already available in firebase deeplink demo and i integrated that. May be you not that's why you were facing an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.