arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.56k forks source link

Receive message on XCode console but push not displayed on iPhone #1012

Open buzz-uion opened 5 years ago

buzz-uion commented 5 years ago

I'm creating a test application, but I can not see the push notifications on the device. Messages triggered through the Firebase console arrive to the App, but the application can not display them.

The console shows that the App has connected correctly to the Firebase (token) and that there are incoming messages:

2019-02-19 17:50:55.142387-0300 HelloWorld[1548:294033]  - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2019-02-19 17:50:55.150727-0300 HelloWorld[1548:293991] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/AA4ADB8A-8F2C-459B-989A-7A7C948A9B51/Library/Cookies/Cookies.binarycookies
2019-02-19 17:50:55.232013-0300 HelloWorld[1548:293991] Apache Cordova native platform version 4.5.5 is starting.
2019-02-19 17:50:55.232094-0300 HelloWorld[1548:293991] Multi-tasking -> Device: YES, App: YES
2019-02-19 17:50:55.237580-0300 HelloWorld[1548:293991] 

Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
2019-02-19 17:50:55.262802-0300 HelloWorld[1548:293991] Using UIWebView
2019-02-19 17:50:55.265299-0300 HelloWorld[1548:293991] [CDVTimer][console] 0.058055ms
2019-02-19 17:50:55.265406-0300 HelloWorld[1548:293991] [CDVTimer][handleopenurl] 0.057936ms
2019-02-19 17:50:55.266610-0300 HelloWorld[1548:293991] [CDVTimer][intentandnavigationfilter] 1.174092ms
2019-02-19 17:50:55.266700-0300 HelloWorld[1548:293991] [CDVTimer][gesturehandler] 0.050068ms
2019-02-19 17:50:55.266828-0300 HelloWorld[1548:293991] Starting Firebase plugin
2019-02-19 17:50:55.266855-0300 HelloWorld[1548:293991] [CDVTimer][firebaseplugin] 0.134945ms
2019-02-19 17:50:55.266875-0300 HelloWorld[1548:293991] [CDVTimer][TotalPluginStartup] 1.685023ms
2019-02-19 17:50:55.327581-0300 HelloWorld[1548:293991] GoogleService-Info.plist found, setup: [FIRApp configureWithOptions]
2019-02-19 17:50:55.341158-0300 HelloWorld[1548:294034] 5.7.0 - [Firebase/Analytics][I-ACS023007] Analytics v.50101000 started
2019-02-19 17:50:55.342705-0300 HelloWorld[1548:294034] 5.7.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2019-02-19 17:50:55.352934-0300 HelloWorld[1548:293991] [Crashlytics] Version 3.10.7 (130)
2019-02-19 17:50:55.448166-0300 HelloWorld[1548:294050] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x281358f00, domain=1, instance=1>
2019-02-19 17:50:55.465706-0300 HelloWorld[1548:294034] 5.7.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2019-02-19 17:50:55.476043-0300 HelloWorld[1548:294038] 5.7.0 - [Firebase/Messaging][I-FCM002023] The object <AppDelegate: 0x281370940> does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token.
2019-02-19 17:50:55.851358-0300 HelloWorld[1548:293991] Unable to connect to FCM. Error Domain=com.google.fcm Code=501 "(null)"
2019-02-19 17:50:55.872142-0300 HelloWorld[1548:293991] Resetting plugins due to page load.
2019-02-19 17:50:56.187876-0300 HelloWorld[1548:294080] [Fabric] failed to download settings Error Domain=FABNetworkError Code=-5 "(null)" UserInfo={status_code=403, type=2, request_id=3da77a3472b0c2f53584580d7f31bd50, content_type=application/json; charset=utf-8}
2019-02-19 17:50:56.291236-0300 HelloWorld[1548:293991] Finished load of: file:///var/containers/Bundle/Application/B7A1D05C-53B4-4093-A755-365DF844BCA5/HelloWorld.app/www/index.html
2019-02-19 17:50:56.294016-0300 HelloWorld[1548:293991] Received Event: deviceready
2019-02-19 17:50:57.132784-0300 HelloWorld[1548:293991] InstanceID token: eGQVhSiAO0Y:APA91bE8iFTCm1gRxoJCykItYqGKTldw3GVsb6jGht-tcxcT00saXTVBto--JahjwnDoDrBJ7yrIU-6KZasQhSF5gFJj9SzJkPXIoyyWsPhmliUL0Mg5REHdd5zm0tcZq-KgqP21WTDz
**2019-02-19 17:51:04.372702-0300 HelloWorld[1548:293991] Connected to FCM.
2019-02-19 17:51:04.383423-0300 HelloWorld[1548:293991] InstanceID token: eGQVhSiAO0Y:APA91bE8iFTCm1gRxoJCykItYqGKTldw3GVsb6jGht-tcxcT00saXTVBto--JahjwnDoDrBJ7yrIU-6KZasQhSF5gFJj9SzJkPXIoyyWsPhmliUL0Mg5REHdd5zm0tcZq-KgqP21WTDz**
2019-02-19 17:51:28.969956-0300 HelloWorld[1548:293991] **Received data message: {
    from = 2766061753;
    image = "https://firebase.google.com/images/social.png";
    message = "Hello how are you?";
    title = "New Text Message";
}**

See on: "Received data message:.."

[Using]

Plugin version: 2.0.5 Cordova iOS: cordova-ios@4.5.5 Cordova CLI: 8.1.2 (cordova-lib@8.1.1) Build System: Legacy Build System

ansarikhurshid786 commented 5 years ago

have you resolved issue?

petert37 commented 5 years ago

I have the same issue. For me the notifications stopped displaying after I installed the cordova-plugin-deeplinks plugin.

The messages show up in the XCode console and the callback is triggered when the app is open, but the notification is not displayed.

Cordova iOS: cordova-ios@4.5.5 Cordova CLI: 8.1.2 (cordova-lib@8.1.1) Build System: Legacy Build System Plugins: cordova-plugin-advanced-http 2.0.4 "Advanced HTTP plugin" cordova-plugin-deeplinks 1.1.0 "Cordova Deeplinks Plugin" cordova-plugin-file 6.0.1 "File" cordova-plugin-firebase 2.0.5 "Google Firebase Plugin" cordova-plugin-geolocation 4.0.1 "Geolocation" cordova-plugin-googlemaps 2.5.0 "cordova-plugin-googlemaps" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-web-share 1.2.0 "WebShare" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-plugin-wkwebview-engine 1.1.4 "Cordova WKWebView Engine"

When the cordova-plugin-deeplinks plugin is installed, the notification in the XCode console looks like this:

2019-02-27 15:13:30.898157+0100 MyApp[380:45899] Received data message: {
    defBody = "My default body";
    defTitle = "My default title";
    from = 324170331014;
    group = GHdUQcSvDi1rkJpRE0wO;
    id = aCg9IjQpVknV4yO9G5xd;
}

When the cordova-plugin-deeplinks plugin is not installed, the notification in the XCode console looks like this:

2019-02-27 16:51:42.472750+0100 MyApp[493:61009] {
    aps =     {
        alert =         {
            body = "My body";
            "loc-args" =             (
                "My",
                "body"
            );
            "loc-key" = "notification_body";
            title = Title;
            "title-loc-args" =             (
                Title
            );
            "title-loc-key" = "notification_title";
        };
        "content-available" = 1;
    };
    defBody = "My default body";
    defTitle = "My default title";
    "gcm.message_id" = 1551282701834484;
    "google.c.a.e" = 1;
    group = GHdUQcSvDi1rkJpRE0wO;
    id = xescBwo24sqEfci9gO7Y;
    tap = 0;
}
petert37 commented 5 years ago

Ok, I solved my problem. There was a conflict in how the two plugins managed the ios entitlements. After I fixed that, the notifications still didn't show up. I had to remove the app from the device and rebuild and reinstall it to fix the problem. Now the notifications work properly.

buzz-uion commented 5 years ago

have you resolved issue?

No. The problem still continues =/

buzz-uion commented 5 years ago

Ok, I solved my problem. There was a conflict in how the two plugins managed the ios entitlements. After I fixed that, the notifications still didn't show up. I had to remove the app from the device and rebuild and reinstall it to fix the problem. Now the notifications work properly.

In my case, my project does not have any additional plugins. I am using the demo project, believed that there is no conflicting plugin at the moment.

evinkuraga commented 5 years ago

@buzz-uion ever managed to fix this? @petert37 Care to elaborate on the ios entitlements? I've spent 3 days on trying to get notifications to work on iOS without any success. Entitlements is the only thing I haven't really looked into yet, but then again, i tried to install a fresh cordova app to test this, so there wouldn't be any conflicts with other plugins.

JumBay commented 5 years ago

I have the same issue. Tried to remove other plugins but still not working

petert37 commented 5 years ago

@buzz-uion ever managed to fix this? @petert37 Care to elaborate on the ios entitlements? I've spent 3 days on trying to get notifications to work on iOS without any success. Entitlements is the only thing I haven't really looked into yet, but then again, i tried to install a fresh cordova app to test this, so there wouldn't be any conflicts with other plugins.

The deeplinks plugin created its own Entitlements.plist file and changed XCode settings to use the new file (XCode project settings / Build settings / Code Signing Entitlements). So whatever the firebase plugin put into the entitlements was ignored.

You could check that the XCode settings are set to the default entitlements files (platforms/ios/<ProjectName>/Entitlements-Debug.plist) (and the same with Entitlements-Release.plist).

Also you could check that these files have something like this in them:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>aps-environment</key>
    <string>development</string>
  </dict>
</plist>

Finally you could check that in XCode Project settigns / Capabilities the Push Notifications are ON

But the notifications only started working for me after I Manually Removed the app from the device and then reinstalled it.