Giter Site home page Giter Site logo

Comments (24)

jackie-d avatar jackie-d commented on June 12, 2024 1

Hi, I confirm the strange behaviour still detected. The only listener triggered is still the didReceiveRemoteNotification on line 192 with any type of notification (data/notification message).

With notification messages the badge appears, the JS callback gets never invoked in any case.

Authorization window and registration process seem fine.

Further investigation needed.

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024 1

This error is due to an installation error, as the pod file was not created or pod install was not run.
Did you install the cordova-plugin-fcm-with-dependecy-updated@beta?

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024 1

Released as v5.0.0. Thank you for the helping. I've mentioned the help in the github release.

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024

Firstly, thank you for the through description.

About you investigations:

look at AppDelegate+FCMPlugin.m code in the plugin, at the didReceiveRemoteNotification method. There on line 196 we found that the data notification is "being handled by the notification center" (what?) and just interrupt execution.

  • For iOS up to 9, the method that responds to push is the one in line 192. For iOS 10 up, the method is the one at line 95.

About your questions:

What's the purpose of the onNotification method on iOs? (In my case's never called)
It should be called with payload of:

  • It should be called with the payload, similar to Android's behaviour.

What's the purpose of the onFirebaseDataNotificationIOS method on iOs? (In my case's never called)

What's the purpose of the getAPNSToken method on iOs? (Do I actually need it ever to be able to receive a notification or it's just an utilities for other systems besides FCM?)

  • Yes, it is an utility method to expose a token to be used for other systems.
    Both Android and iOS will will make use of the Firebase Token, which can be retrieved with getToken.
    iOS will also have a APNS token, which can be retrieved by this utility method getAPNSToken.

To help me understand your situation, would you mind sharing the app's runtime log while you receive the notification. In both app on foreground and on the background?

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

from cordova-plugin-fcm-with-dependecy-updated.

viksat7 avatar viksat7 commented on June 12, 2024

I also have similar issue in IOS, when the IOS is in foreground, notification doesn't get displayed as well onNotification is not triggered to fetch the notification data even in background

Android works fine in foreground and background

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

I'm moving on with code checks.

I also get this on iOs on Notification Permission request acceptation by the user:

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication registerForRemoteNotifications]
PID: 3253, TID: 1938670, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0
Backtrace:
4   MyApp                           0x000000010270ae18 __73-[AppDelegate(MCPlugin) application:customDidFinishLaunchingWithOptions:]_block_invoke + 132
5   libdispatch.dylib                   0x0000000102f617fc _dispatch_call_block_and_release + 24
6   libdispatch.dylib                   0x0000000102f62bd8 _dispatch_client_callout + 16
7   libdispatch.dylib                   0x0000000102f69b48 _dispatch_lane_serial_drain + 744
8   libdispatch.dylib                   0x0000000102f6a718 _dispatch_lane_invoke + 500
9   libdispatch.dylib                   0x0000000102f75adc _dispatch_workloop_worker_thread + 1324
10  libsystem_pthread.dylib             0x00000001a81c2b88 _pthread_wqthread + 276
11  libsystem_pthread.dylib             0x00000001a81c5760 start_wqthread + 8
2020-04-10 16:33:37.959326+0200 MyApp[3253:1938670] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication registerForRemoteNotifications]
PID: 3253, TID: 1938670, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0
Backtrace:
4   MyApp                           0x000000010270ae18 __73-[AppDelegate(MCPlugin) application:customDidFinishLaunchingWithOptions:]_block_invoke + 132
5   libdispatch.dylib                   0x0000000102f617fc _dispatch_call_block_and_release + 24
6   libdispatch.dylib                   0x0000000102f62bd8 _dispatch_client_callout + 16
7   libdispatch.dylib                   0x0000000102f69b48 _dispatch_lane_serial_drain + 744
8   libdispatch.dylib                   0x0000000102f6a718 _dispatch_lane_invoke + 500
9   libdispatch.dylib                   0x0000000102f75adc _dispatch_workloop_worker_thread + 1324
10  libsystem_pthread.dylib             0x00000001a81c2b88 _pthread_wqthread + 276
11  libsystem_pthread.dylib             0x00000001a81c5760 start_wqthread + 8

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024

I can't believe it can be just a simple as running the registerForRemoteNotifications in the main thread. 😆

I'll create a new patch version with the fix.

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Did I really get that? I just followed the procedure to re-install the app and it came out.

Yeah, btw, I confirm that on the current plugin version and iOs 13.3, the only breakpoint hit it's on method on line 192 didReceiveRemoteNotification.

Other methods @152: didReceiveRemoteNotification , @95, @119 (userNotificationCenter:...) are never reached, with any type of notification payload.

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024

Would you try the new version 4.6.1?

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Gotcha, I'll test again and share here the results

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Hi, made a quick test, the permission initialization error output isn't appearing any more, so the initialization seems pretty solved.

But from the previous indicated callback it's still hitting just the didReceiveRemoteNotification@194, and the JS callback are never reached.

The difference now is that the data notification type with just the data payload is actually being handled properly and not being shown in the system notification traybar.

I also get this error on receiving the notification:

2020-04-10 20:56:59.550475+0200 MyApp[3346:1996366] Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.

I'll give a better look at the JS code tomorrow.

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Hi just make some more debugging...

Relevant related doc:

My conclusion is that something messed up with method swizzling and now all the notification are always delivered to the didReceiveRemoteNotification and the didReceiveRemoteNotification/fetchCompletionHandler methods, when they are coded so the app relies on the userNotificationCenter/willPresentNotification and the userNotificationCenter/didReceiveNotificationResponse.

This happens even if I set the FirebaseAppDelegateProxyEnabled to NO in my *-info.plist.

It seems that Firebase doc it's a bit confusing and I can't tell if Swizzling it's enabled or not, but I can tell for sure that with iOS 13.3 I just get into didReceiveRemoteNotification. (with "cordova-plugin-fcm-with-dependecy-updated": "^4.6.1")

From the doc:

The FCM SDK performs method swizzling in two key areas: mapping your APNs token to the FCM registration token and capturing analytics data during downstream message callback handling. Developers who prefer not to use swizzling can disable it by adding the flag FirebaseAppDelegateProxyEnabled in the app’s Info.plist file and setting it to NO (boolean value). Relevant areas of the guides provide code examples, both with and without method swizzling enabled.

and

In iOS 10 and above, you can set the UNUserNotificationCenter delegate to receive display notifications from Apple and FIRMessaging's delegate property to receive data messages from FCM. If you do not set these two delegates with AppDelegate, method swizzling for message handling is disabled. You'll need to call appDidReceiveMessage: to track message delivery and analytics.

So, there are two paths of solution:

  • modify the plugin to rely on thedidReceiveRemoteNotification methods to handle all the notification (for me with would be OK, but it would maybe preclude others APNS aspects?) for its current state
  • assure that the swizzling is disabled and relay on methods from userNotificationCenter and FIRMessagingDelegate to display notification data.

What do you think?

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024

Makes sense.

I'd also like to clean up a bit.
As the cordova-ios 5 targets, by default, iOS 10. It's a good time to remove the iOS 9-specific build-time code.

What do you think?

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024

Hi @jackie-d

Please install the beta version "beta" (v5.0.0-beta.1), which has changes you mention, plus some refactoring.

Changelog: https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated/releases/tag/v5.0.0-beta.0

Thank you for the support

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Hi,
just read everything, seems great! I'll make a test and let you know my consideration asap!

Thanks 💯 😸

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024

Thank you, with cleaning, comes a better place to add features! :)

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Yeah I've no doubt bout that, today has been a fully day, I'll try to give a look tomorrow at a glance and in case to proceed on with some testing.

I'll let you know. Thanks a lot for now, cheers

from cordova-plugin-fcm-with-dependecy-updated.

JakeFargo avatar JakeFargo commented on June 12, 2024

Hello!

I too am running into this issue. Do you have an idea as to when we will have the update / fix available?

Thank you for your work on this!

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Just got a couple hour to put my head on this, but I'm having an error at build time in Xcode:

Lexical or Preprocessor Issue Group
Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m:7:9: 'Firebase.h' file not found

is there any other dependency needed?

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Yes installed as

cordova plugin add https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated.git#v5.0.0-beta.0

also made a

pod repo update
pod install

Now reinstalling...

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 12, 2024

There were more fixes in beta.

cordova plugin add cordova-plugin-fcm-with-dependecy-updated@beta

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Hi, I confirm that I can receive the notification payload and I see it logged in the console, also the new code seems really shorter and concise but effective.

Now i'm battling with another error on the app because I have to resolve some new errors that came out after this latest update but I cannot tell now if they're related to it or to something else.

It seems good as now, but I will be able to confirm it tomorrow.

Ciao!

from cordova-plugin-fcm-with-dependecy-updated.

jackie-d avatar jackie-d commented on June 12, 2024

Hello!!! Sorry for the late response I had several trouble with npm/cordova/plugin/platform combinations for no reason.

Finally I can totally confirm your new version is correctly working in all scenarios.

And the code it's really cleaner, great job 😊

I'll wait for it on the official channel!!! Thanks a lot!

from cordova-plugin-fcm-with-dependecy-updated.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.