Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase dynamiclink event not fired in ios #84

Open
karen1au opened this issue Oct 9, 2020 · 11 comments
Open

Firebase dynamiclink event not fired in ios #84

karen1au opened this issue Oct 9, 2020 · 11 comments

Comments

@karen1au
Copy link

karen1au commented Oct 9, 2020

it works smoothly in Android, however in iOS when I launch app in XCode, FirebaseDynamicLink plugin is init and onDynamicLink is called, clicking the url from browser doesn't open the link in the app. After I configured associated domains with applinks:example.page.link it does open the app (since this part is not in the doc for the plugin, i'm not sure if it's actually required?) but the callback for authentication is not executed, in the log I see this:

 [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
    amv = "";
    apn = "com.example.app";
    ibi = "com.example.app";
    ifl = "https://exampleproject.firebaseapp.com/__/auth/action?apiKey=xxxxxxxx&mode=signIn&oobCode=xxxxxxxxxxx&continueUrl=https://example.page.link&lang=en";
    link = " "https://exampleproject.firebaseapp.com/__/auth/action?apiKey=xxxxxxxx&mode=signIn&oobCode=xxxxxxxxxxx&continueUrl=https://example.page.link&lang=en";
}
@marcocrodutti
Copy link

Same here

@ericgopak
Copy link

ericgopak commented Nov 13, 2020

Same problem similar error message:
7.1.0 - [Firebase/Analytics][I-ACS023000] Deep Link Web URL query is empty
The plugin seems to refer to Firebase/Analytics ~> 7.0.0, so perhaps the issue is with version 7.1.0

Update: version 7.0.0 yields the same error.
Here's someone with the same issue, who digged a bit deeper: stackoverflow.

@ericgopak
Copy link

Update:

I'm neither iOS nor Objective-C expert, but I've spent some time digging through the code and came up with a workaround: check out my fork here. Unfortunately, it still doesn't work with cold start (e.g. the app doesn't receive the link if the app was not running).

There are a plenty of challenges here involved: method swizzling doesn't work (in AppDelegate+FirebaseDynamicLinksPlugin.m) and I'm not exactly sure why. Could be because Capacitor initializes the plugin too late, so the swizzling doesn't really work, or could be because main Capacitor app is written in Swift. Also, Firebase-related pods seem to rely on GoogleUtilities which includes its own method swizzling (e.g. in GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m)`.

I think someone with better iOS-dev background should take a look.

If you're also using Capacitor, considering this plugin: https://github.com/Turnoutt/capacitor-firebase-dynamic-links

@nuno
Copy link

nuno commented Nov 23, 2020

@karen1au, @marcocrodutti, and @ericgopak -

I had the same issue, to solve it I had to use the right way to work with URLs and query strings. Let me know if that helps.

const URLPARAMS = new URL(`https://myapp/invite`);
          URLPARAMS.searchParams.append('inviteTo', params.phoneNumber);
          URLPARAMS.searchParams.append('invitedId',this.user._id);
          URLPARAMS.searchParams.append('invitedbyGroupId', this.currentGroup._id);
          URLPARAMS.searchParams.append('invitedbyEmail', params.email);

createShortDynamicLink({
          domainUriPrefix: "https://myapp.page.link",
          link: URLPARAMS.href,
          .....

@karen1au
Copy link
Author

karen1au commented Mar 9, 2021

@ericgopak I'm trying with the capacitor plugin but it's giving me the same error

7.0.0 - [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
    amv = "";
    apn = "com.example.app";
    ibi = "com.example.app";
    ifl = "https://xxx";
    link = "https://xxx";
}

code inside this never get executed...

CapacitorFirebaseDynamicLinks.addListener('deepLinkOpen', (data) => doing something)

@karen1au
Copy link
Author

karen1au commented Mar 9, 2021

@nuno thanks for your solution! But i'm using firebase generated link for authentication so I don't really have control in constructing the link :(

@marcocrodutti
Copy link

Thank you @nuno.
Like @karen1au I am trying to open a generated link.

I can add a detail: we are using React. Is it the same for you @karen1au ?

@karen1au
Copy link
Author

karen1au commented Mar 9, 2021

@marcocrodutti I'm using Vue, but it shouldn't matter?

@marcocrodutti
Copy link

You are right, sorry. It is not relevant.

@karltm
Copy link

karltm commented Aug 24, 2021

For me, converting the manually constructed long dynamic link to a short dynamic link fixed this error (using latest DynamicLinks version 8.6.0)

@karltm
Copy link

karltm commented Sep 16, 2021

For me, converting the manually constructed long dynamic link to a short dynamic link fixed this error (using latest DynamicLinks version 8.6.0)

okay this works only when the app is open already, not for a cold start. then it brings me to the main screen within my app (Edit: when cold starting, getDynamicLink() can be used to handle dynamic links on iOS)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants