chemerisuk / cordova-plugin-firebase-dynamiclinks

Cordova plugin for Firebase Dynamic Links
55 stars 150 forks source link

onDynamicLink Event not firing on iOS #15

Open erikm30 opened 6 years ago

erikm30 commented 6 years ago

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 commented 6 years ago

I have the same issue. Using Ionic 3.

AndreasGassmann commented 6 years ago

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 commented 6 years ago

What cordova-ios version do you have?

AndreasGassmann commented 6 years ago

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

murshid1988 commented 6 years ago

Mine is cordova-ios 4.5.5 cordova 8.0.0

murshid1988 commented 6 years ago

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

AndreasGassmann commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

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

AndreasGassmann commented 6 years ago

@murshid1988 Did you find anything out?

murshid1988 commented 6 years ago

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

AndreasGassmann commented 6 years ago

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

murshid1988 commented 6 years ago

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 commented 5 years ago

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 commented 5 years ago

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 (cordova-lib@8.1.1)
   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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

josh-m-sharpe commented 4 years ago

@nstokoe did you get something working?

kassamina commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

crebuh commented 4 years ago

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 (cordova-lib@9.0.1) 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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 (cordova-lib@9.0.1) 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 commented 4 years ago

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 commented 3 years ago

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 (cordova-lib@8.1.1)
   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 (cordova-lib@8.1.1)
   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 commented 3 years ago

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 commented 3 years ago

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

tzappia commented 2 years ago

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.