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_dynamic_link] listener not being called on iOS #262

Closed
quetool opened this issue Oct 3, 2019 · 17 comments
Closed

[firebase_dynamic_link] listener not being called on iOS #262

quetool opened this issue Oct 3, 2019 · 17 comments
Labels
type: bug Something isn't working

Comments

@quetool
Copy link

quetool commented Oct 3, 2019

I have tried both on iOS 12 and 13 and FirebaseDynamicLinks.instance.onLink listener is not being called at all... App is opened just fine, but like I said, the listener is not being called...

@quetool
Copy link
Author

quetool commented Oct 3, 2019

I debugged my Dynamic Link and it looks fine...
Captura de Pantalla 2019-10-03 a la(s) 17 00 09
Captura de Pantalla 2019-10-03 a la(s) 17 00 27

@quetool
Copy link
Author

quetool commented Oct 3, 2019

So, finally I found the solution... In Dynamic Link firebase docs you will find this:

Captura de Pantalla 2019-10-03 a la(s) 17 49 18

I must say this is not mentioned in the flutter plugin README doc
https://pub.dev/packages/firebase_dynamic_links#-readme-tab-

So adding that key I solved the issue...

Here it is the doc https://firebase.google.com/docs/dynamic-links/custom-domains?authuser=0

@HofmannZ
Copy link

HofmannZ commented Oct 4, 2019

Hi @quetool,

Just wondering what you exactly managed to solve by adding the FirebaseDynamicLinksCustomDomains key. Did you manage to read the dynamic link, and its path, in flutter?

@quetool
Copy link
Author

quetool commented Oct 7, 2019

@HofmannZ yes, before I realize I needed to add that key on the info.plist dynamic links were not being readed at all, not from FirebaseDynamicLinks.instance.getInitialLink() nor even from FirebaseDynamicLinks.instance.onLink

@HofmannZ
Copy link

HofmannZ commented Oct 7, 2019

@quetool managed to get that working, though the onLink seems to subscribe multiple times and has no dispose method :s Did you get that to work?

@quetool
Copy link
Author

quetool commented Oct 7, 2019

@HofmannZ you need to add the onLink listener once in an initState() method or in a singleton class. I think you are instantiating the FirebaseDynamicLinks more than one time.

@HofmannZ
Copy link

HofmannZ commented Oct 7, 2019

@quetool Yeah came to that conclusion as well. The only problem I had was that I was calling onLink from inside each page, without the putting FirebaseDynamicLinks inside a singleton. Puting it inside a singleton should solve the issue.

Also using initState outside MaterialApp is not ideal because you don't have to context of the Navigator

@quetool
Copy link
Author

quetool commented Oct 7, 2019

I have a main container class (a stateful widget) that contains the entire app. On its initState method I instantiate the FirebaseDynamicLinks.instance with its onLink method. Then I use streams to communicate the link parsing result wherever I want to. But that's my approach.

@HofmannZ
Copy link

HofmannZ commented Oct 7, 2019

@quetool how did you solve getting the Navigator context? Using navigatorKey I'm guessing?

@quetool
Copy link
Author

quetool commented Oct 7, 2019

Maybe is better if you provide some code and an explanation on what you need to do... I do not have problem getting current context becauase like I said I manage everything inside a stateful widget... Anyway, this is just for issues, maybe you can open a question on SO

@HofmannZ
Copy link

HofmannZ commented Oct 8, 2019

PR #255 managed to fix my issue, thanks!

@quetool
Copy link
Author

quetool commented Oct 8, 2019

I do not have that sort of problems described on that PR but ok

@emmett-deen
Copy link

So, finally I found the solution... In Dynamic Link firebase docs you will find this:

Captura de Pantalla 2019-10-03 a la(s) 17 49 18

I must say this is not mentioned in the flutter plugin README doc
https://pub.dev/packages/firebase_dynamic_links#-readme-tab-

So adding that key I solved the issue...

Here it is the doc https://firebase.google.com/docs/dynamic-links/custom-domains?authuser=0

This MUST be included on pub.dev I feel a large amount of developers will want to use custom domains and will have to dig through hundreds of issues to find this.

@kwent
Copy link

kwent commented Feb 8, 2020

Please guys update the doc. So hard to find this!

@cg-manish
Copy link

Thanks @emmett-deen for your comment. This problem still exists and your comment helped to solve the problem. I can't believe the plugin's readme is still not updated.

@quetool
Copy link
Author

quetool commented Jun 17, 2020

@surpriso1997 uhm... I think you are talking about MY comment :P

@cg-manish
Copy link

@quetool oops sorry, didn't realise that was quoted comment from @emmett-deen
Thanks a lot man for mentioning that.

@firebase firebase locked and limited conversation to collaborators Aug 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants