wizpanda / cordova-plugin-firebase-lib

This repository is moving & merging to https://github.com/wizpanda/cordova-plugin-firebase-lib to avoid confusion to developers.
https://www.wizpanda.com/
MIT License
68 stars 38 forks source link

iOS12 compatibility (messaging:didReceiveRegistrationToken) #10

Closed vlafranca closed 5 years ago

vlafranca commented 5 years ago

Hi guys, first of all I would like to thank you to have forked this repository and maintained it !

I am actually struggling over all the pushes plugins to get notifications working on ios 12, every plugin gives this error : 5.7.0 - [Firebase/Messaging][I-FCM002023] The object <AppDelegate: 0x2803b34c0> does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token.

It seems a new method is required on ios to receive notifications, here is a plugin which implemented it, and actually it is the only plugin with which I got notifications working on ios12 : https://github.com/chemerisuk/cordova-plugin-firebase-messaging

ref to the file with implemented method : https://github.com/chemerisuk/cordova-plugin-firebase-messaging/blob/f84757b3a86b7240d731e0368cf9e0aaaf5fffcb/src/ios/AppDelegate%2BFirebaseMessagingPlugin.m

Unfortunately this plugin is only compatible with cordova9, so if you could implement it that could be awesome !

Thanks in advance for your help !

vlafranca commented 5 years ago

Okay just needed to call grantPermission and it worked! I tried on many plugins and it wasn't working, so you guys made a great work

sagrawal31 commented 5 years ago

We are glad you found this fork helpful!

l3ender commented 4 years ago

I'm seeing the same warning (does not respond to -messaging:didReceiveRegistrationToken).

If I inspect the pod source code for FIRMessaging.m, I see:

#pragma mark - FIRMessagingDelegate helper methods
- (void)setDelegate:(id<FIRMessagingDelegate>)delegate {
  _delegate = delegate;
  [self validateDelegateConformsToTokenAvailabilityMethods];
}

// Check if the delegate conforms to |didReceiveRegistrationToken:|
// and display a warning to the developer if not.
// NOTE: Once |didReceiveRegistrationToken:| can be made a required method, this
// check can be removed.
- (void)validateDelegateConformsToTokenAvailabilityMethods {
  if (self.delegate &&
      ![self.delegate respondsToSelector:@selector(messaging:didReceiveRegistrationToken:)]) {
    FIRMessagingLoggerWarn(kFIRMessagingMessageCodeTokenDelegateMethodsNotImplemented,
                           @"The object %@ does not respond to "
                           @"-messaging:didReceiveRegistrationToken:. Please implement "
                           @"-messaging:didReceiveRegistrationToken: to be provided with an FCM "
                           @"token.", self.delegate.description);
  }
}

So I can see the warning is being logged when the delegate is set from this plugin. Doesn't that mean this plugin needs to implement messaging:didReceiveRegistrationToken?