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

onDynamicLink Event not firing on iOS #15

Open
erikm30 opened this issue Aug 3, 2018 · 33 comments
Open

onDynamicLink Event not firing on iOS #15

erikm30 opened this issue Aug 3, 2018 · 33 comments

Comments

@erikm30
Copy link

erikm30 commented Aug 3, 2018

On Android everything works smoothly, but on iOS the onDynamicLink event is not firing, so we cannot get the payload out of the link.

@murshid1988
Copy link

I have the same issue. Using Ionic 3.

@AndreasGassmann
Copy link

AndreasGassmann commented Aug 10, 2018

I have the same problem.

Maybe it's related to this?

---- Firebase Dynamic Links diagnostic output start ----
Firebase Dynamic Links framework version 3.0.1
System information: OS iOS, OS version 11.2.6, model iPhone
Current date 2018-08-06 03:47:11 +0000
Device locale en-CH (raw en_CH), timezone Europe/Zurich
ERROR: UIApplication delegate <AppDelegate: 0x1c4225240> does not implements selector application:openURL:options:. FDL depends on this implementation to retrieve pending dynamic link.
	AppID Prefix: xxx, Team ID: xxx, AppId Prefix equal to Team ID: YES
performDiagnostic detected 1 ERROR.
---- Firebase Dynamic Links diagnostic output end ----

Are you getting the same error when you enable the diagnostics output?

@chemerisuk
Copy link
Owner

What cordova-ios version do you have?

@AndreasGassmann
Copy link

My cordova-ios version is 4.5.5.
cordova version is 7.1.0

@murshid1988
Copy link

Mine is
cordova-ios 4.5.5
cordova 8.0.0

@murshid1988
Copy link

@AndreasGassmann May I know how did you manage to get the Firebase Dynamic Links diagnostics to work?

@AndreasGassmann
Copy link

@murshid1988 I followed the instructions here: https://firebase.google.com/docs/dynamic-links/debug

To make sure the plugin was completely initialized, I added [FIRDynamicLinks performDiagnosticsWithCompletion:nil]; to another plugin that I know would be called only after some time (in my case I added it to the QR scanner plugin, so when I triggered the plugin, the Firebase Diagnostic was printed). I'm not sure if this is necessary though.

@murshid1988
Copy link

@AndreasGassmann I mean I would like to know the path or the file you added. I tried putting the code in /node_modules/cordova-plugin-firebase-dynamiclinks/src/ios/FirebaseDynamicLinksPlugin.m and it didn't work. I might be doing it wrong.

@AndreasGassmann
Copy link

I opened xcode and edited the file in the "plugins" folder. That way you can rebuild and it gets added to the app immediately. I think the problem for you is that the code doesn't actually get built. Just add a simple NSLog(@"Test") to see if the code is included in your project.

@murshid1988
Copy link

@AndreasGassmann Cool. Thanks. I will check and let you know.

@AndreasGassmann
Copy link

@murshid1988 Did you find anything out?

@murshid1988
Copy link

@AndreasGassmann Nope not yet. Waiting for my friend to return the Mac. I will update you

@AndreasGassmann
Copy link

@murshid1988 Any updates? I still didn't manage to get this to work.

@murshid1988
Copy link

Nope. Couldn't get the diagnostic output even. But the strange thing is if the links shared in facebook the app manages to open it. But WhatsApp and other messaging platforms such as Telegram are not doing the expected. I feel like this has something do with the app page generated by Firebase.

@ericgopak
Copy link

ericgopak commented Dec 14, 2018

I've come across the same issue. Is there any solution to this?

cordova (Cordova CLI) : 7.1.0
Cordova Platforms     : ios 4.5.5

Xcode                 : Xcode 9.2 Build version 9C40b

Edit:
I tried this fork - https://github.com/Chuckv01/cordova-plugin-firebase-dynamiclinks - and it worked for me.

@nstokoe
Copy link

nstokoe commented Jan 11, 2019

Same issue here. I'm using the plugin through capacitor with cordova plugins. I can get the dynamic link to open my app via an associated domain, and firebase analytics even logs the APP ACTIVE message, but the onDynamicLink method does not fire.


   ionic (Ionic CLI)          : 4.2.0 (/usr/local/Cellar/node@8/8.11.3_1/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-rc.0
   @angular-devkit/core       : 7.1.3
   @angular-devkit/schematics : 7.1.3
   @angular/cli               : 7.1.3
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.7

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.11
   @capacitor/core           : 1.0.0-beta.11

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (1 plugins total)

System:

   ios-deploy : 1.9.1
   ios-sim    : 6.1.2
   NodeJS     : v10.9.0 (/Users/nstokoe/.nvm/versions/node/v10.9.0/bin/node)
   npm        : 6.2.0
   OS         : macOS
   Xcode      : Xcode 10.1 Build version 10B61

@alfazjikani
Copy link

I had similar issue about plugin initialization for iOS. I added below code in load method of file AppDelegate+FirebaseDynamicLinksPlugin.m and it worked. Attaching file for reference.
AppDelegate+FirebaseDynamicLinksPlugin.txt

//Firebase app initialization
if (![FIRApp defaultApp]) {
[FIRApp configure];
}

@THEDOWNCOUNTRY
Copy link

Hi @nstokoe Where you able to find a solution with this issue I have the same problem and @alfazjikani did get the diagnostic log to to print my app id as custom scheme but onDynamicLink event still not firing.

@nstokoe
Copy link

nstokoe commented Aug 7, 2019

No. After much frusteration, I ended up scraping the code that used this plugin and implemented my own Capacitor plugin (with no Cordova dependencies) that interacted directly with the native FireBase SDKs. I think I may have used this plugin as an example to follow: https://github.com/baumblatt/capacitor-firebase-auth

@THEDOWNCOUNTRY
Copy link

@nstokoe Great way to go, I had that in mind. would you mind sharing your codes after your done?

@josh-m-sharpe
Copy link

@nstokoe did you get something working?

@kassamina
Copy link

I ran into this bug, but was able to get around it with a version bump from

<pod name="Firebase/Analytics" spec="~> 6.3.0" />
<pod name="Firebase/DynamicLinks" spec="~> 6.3.0" />

to

<pod name="Firebase/Analytics" spec="~> 6.5.0" />
<pod name="Firebase/DynamicLinks" spec="~> 6.5.0" />

in plugin.xml

@THEDOWNCOUNTRY
Copy link

I ran into this bug, but was able to get around it with a version bump from

<pod name="Firebase/Analytics" spec="~> 6.3.0" />
<pod name="Firebase/DynamicLinks" spec="~> 6.3.0" />

to

<pod name="Firebase/Analytics" spec="~> 6.5.0" />
<pod name="Firebase/DynamicLinks" spec="~> 6.5.0" />

in plugin.xml

Will give this a try.

@luboslav
Copy link

@kassamina is it working fine in both states (app in background and app killed) ?

@crebuh
Copy link

crebuh commented May 26, 2020

Any updates on this, I've the same problem. On Android everything works fine on iOS the event is firing on startup (for no reason) and afterwards it is not firing anymore. Diagnostic output seems good

---- Firebase Dynamic Links diagnostic output start ----
Firebase Dynamic Links framework version 4.0.8
System information: OS iOS, OS version 13.4.1, model iPhone
Current date 2020-05-26 08:07:21 +0000
Device locale en-AT (raw en_AT), timezone Europe/Vienna
Specified custom URL scheme is xx.yyy.zzz and Info.plist contains such scheme in CFBundleURLTypes key.
AppID Prefix: 12345678, Team ID: 12345678, AppId Prefix equal to Team ID: YES
performDiagnostic completed successfully! No errors found.
---- Firebase Dynamic Links diagnostic output end ----

Ionic:

Ionic CLI : 5.4.15 (/Users/crebuh/.nvm/versions/node/v10.10.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.7.1
@angular-devkit/build-angular : 0.801.2
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0, ios 5.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 18 other plugins)

Utility:

cordova-res (update available: 0.14.0) : 0.6.0
native-run (update available: 1.0.0) : 0.2.9

System:

ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v10.10.0 (/Users/crebuh/.nvm/versions/node/v10.10.0/bin/node)
npm : 6.14.4
OS : macOS Catalina
Xcode : Xcode 11.4.1 Build version 11E503a

@tzappia
Copy link

tzappia commented Jun 2, 2020

I had the same issue for the scenario of when the app was terminated and it was caused by a conflict with cordova-plugin-firebasex.

@alif1993
Copy link

After a couple of days dedicating to getting rid of this bug, I came to the conclusion that using IONIC is MUST NOT do thing.

@alif1993
Copy link

Any updates on this, I've the same problem. On Android everything works fine on iOS the event is firing on startup (for no reason) and afterwards it is not firing anymore. Diagnostic output seems good

---- Firebase Dynamic Links diagnostic output start ----
Firebase Dynamic Links framework version 4.0.8
System information: OS iOS, OS version 13.4.1, model iPhone
Current date 2020-05-26 08:07:21 +0000
Device locale en-AT (raw en_AT), timezone Europe/Vienna
Specified custom URL scheme is xx.yyy.zzz and Info.plist contains such scheme in CFBundleURLTypes key.
AppID Prefix: 12345678, Team ID: 12345678, AppId Prefix equal to Team ID: YES
performDiagnostic completed successfully! No errors found.
---- Firebase Dynamic Links diagnostic output end ----

Ionic:
Ionic CLI : 5.4.15 (/Users/crebuh/.nvm/versions/node/v10.10.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.7.1
@angular-devkit/build-angular : 0.801.2
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0, ios 5.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 18 other plugins)
Utility:
cordova-res (update available: 0.14.0) : 0.6.0
native-run (update available: 1.0.0) : 0.2.9
System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v10.10.0 (/Users/crebuh/.nvm/versions/node/v10.10.0/bin/node)
npm : 6.14.4
OS : macOS Catalina
Xcode : Xcode 11.4.1 Build version 11E503a

Have you come to any solution?

@AverageHelper
Copy link

We're having the same issue on Cordova CLI 9.0.0 and cordova-ios 6.1.0. onDynamicLink fires just fine when the app is in the background, but not at all on launch.

@karen1au
Copy link

karen1au commented Oct 8, 2020

Same issue here. I'm using the plugin through capacitor with cordova plugins. I can get the dynamic link to open my app via an associated domain, and firebase analytics even logs the APP ACTIVE message, but the onDynamicLink method does not fire.


   ionic (Ionic CLI)          : 4.2.0 (/usr/local/Cellar/node@8/8.11.3_1/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-rc.0
   @angular-devkit/core       : 7.1.3
   @angular-devkit/schematics : 7.1.3
   @angular/cli               : 7.1.3
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.7

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.11
   @capacitor/core           : 1.0.0-beta.11

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (1 plugins total)

System:

   ios-deploy : 1.9.1
   ios-sim    : 6.1.2
   NodeJS     : v10.9.0 (/Users/nstokoe/.nvm/versions/node/v10.9.0/bin/node)
   npm        : 6.2.0
   OS         : macOS
   Xcode      : Xcode 10.1 Build version 10B61

Same issue here. I'm using the plugin through capacitor with cordova plugins. I can get the dynamic link to open my app via an associated domain, and firebase analytics even logs the APP ACTIVE message, but the onDynamicLink method does not fire.


   ionic (Ionic CLI)          : 4.2.0 (/usr/local/Cellar/node@8/8.11.3_1/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-rc.0
   @angular-devkit/core       : 7.1.3
   @angular-devkit/schematics : 7.1.3
   @angular/cli               : 7.1.3
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.7

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.11
   @capacitor/core           : 1.0.0-beta.11

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (1 plugins total)

System:

   ios-deploy : 1.9.1
   ios-sim    : 6.1.2
   NodeJS     : v10.9.0 (/Users/nstokoe/.nvm/versions/node/v10.9.0/bin/node)
   npm        : 6.2.0
   OS         : macOS
   Xcode      : Xcode 10.1 Build version 10B61

I'm using capacitor and having the same issue too, did you get to find any solution?

@ericgopak
Copy link

Experiencing the same issue. The problem seems to occur only on iOS with Capacitor.

A post on StackOverflow raises concerns that perhaps the issue is with method swizzling in Objective-C vs. Swift. This plugin is written in Objective-C. Someone wrote an unofficial plugin in Swift here.

@ericgopak
Copy link

ericgopak commented Nov 15, 2020

Update: for those using Capacitor here's a working plugin - https://github.com/Turnoutt/capacitor-firebase-dynamic-links

@tzappia
Copy link

tzappia commented Nov 25, 2021

Ever since the introduction of the getDynamicLink() function, we are able to get the link from a cold startup using the following flow:

document.addEventListener('deviceready', () => {
  cordova.plugins.firebase.dynamiclinks.getDynamicLink().then(data => openLink(data));
  cordova.plugins.firebase.dynamiclinks.onDynamicLink(data => openLink(data));
}, {
  once: true,
  capture: false
});

Where openLink() is how we route the user to the appropriate place.

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