Ad

DidReceiveRemoteNotification Not Called When Firebase Is Used Along With Push Framework

I am using Firebase for analytics and a library for push notifications. When I use either of them, didReceiveRemoteNotification get called. But when I use them both together, didReceiveRemoteNotification doesn't get called.
Code :

didFinishLaunchingWithOptions :

NSString *google_app_id = @"----";
    NSString *gcm_sender_id = @"----";
    FIROptions *o = [[FIROptions alloc] initWithGoogleAppID:google_app_id GCMSenderID:gcm_sender_id];
    o.APIKey = @"----";
    o.bundleID = @"----";
    o.clientID = @"----";
    [FIRApp configureWithOptions:o];  

// Initilization of push framework 

didReceiveRemoteNotification :

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    // This method is not called when Firebase and push framework are enabled at the same time
    // It works fine when only Firebase or only push framework is enabled
    NSLog(@"Push: %@", userInfo);
}
Ad

Answer

This is because Firebase uses swizzling to intercept methods of the AppDelegate.

You should disable it in your app's info.plist:

<key>FirebaseAppDelegateProxyEnabled</key>
<false/>

Actually there is a lot of information about Push Notification in iOS with Firebase on GitHub. You probably will find answers for your further questions there.

Ad
source: stackoverflow.com
Ad