firebase/quickstart-cpp

ios notification_opened dosen´t work when app is in background

isipisi89 opened this issue · 9 comments

Hello together,
i found a bug in firebase messaging.
The notification_opened property dosen´t work on ios when the app is in the background.
It work fine when the app is closed and was started from a tap to the notification.

On Android it work fine when app is closed and in the background.
I check it like this:

if (message.notification_opened) { const QString key = QStringLiteral("launchnotification"); data.insert(key, true); }

Regards Isy

Thanks for the report. I'll investigate the issue.

Was the error reproducible?

Sorry for the lack of feedback. This issue should be fixed in the 4.1.0 release. If you're still seeing the issue let me know.

@isipisi281 @alexames I think problem do not resolved

This is my current output:

2017-12-06 11:23:53.892957+0100 App[868:594072] FCM: Initialize Firebase Messaging
2017-12-06 11:23:53.893041+0100 App[868:594072] FCM: Using FCM senderID 56*********
2017-12-06 11:23:53.893442+0100 App[868:594072] FCM: Retrieve registration token
fg********:********************************************************

I then push the home button - and get:

2017-12-06 11:24:03.612624+0100 App[868:594072] FCM: Disconnect FCM service

Send out a message via the firebase console
Then I enter the app again:

2017-12-06 11:25:15.182992+0100 App[868:594072] FCM: Connected to FCM
2017-12-06 11:25:16.472608+0100 App[868:594072] FCM: Received message

So the message comes in when the app is opened back up - but I haven't seen any notifications yet :/

(@stewartmiles)

@larpon Yes there is no notification popup at all only console log show message received
My full log

2017-12-06 14:11:44.815526+0330 Project[3185:968912] [DYMTLInitPlatform] platform initialization successful
2017-12-06 14:11:44.927146+0330 Project[3185:968763] FCM: Loading UIApplication FIRFCM category
2017-12-06 14:11:45.745470+0330 Project[3185:968763] Setting up iOS 10 message delegate.
JIT is disabled for QML. Property bindings and animations will be very slow. Visit https://wiki.qt.io/V4 to learn about possible solutions for your platform.
stale focus object QObject(0x0) , doing manual update
libpng warning: iCCP: known incorrect sRGB profile
QtFirebaseMessaging(0x12b40a180) ::QtFirebaseMessaging singleton
QObject(0x0) :QtFirebase(QObject* parent)
2017-12-06 14:11:48.133277+0330 Project[3185:968895] [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40005000 started
QtFirebase::requestInit created the Firebase App (27ec38b0)
QtFirebase(0x12b409f50) ::requestInit initialized
2017-12-06 14:11:48.225572+0330 Project[3185:968927] [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2017-12-06 14:11:48.295736+0330 Project[3185:968763] FCM: Initialize Firebase Messaging
2017-12-06 14:11:48.295828+0330 Project[3185:968763] FCM: Using FCM senderID -----
2017-12-06 14:11:48.296488+0330 Project[3185:968763] FCM: Retrieve registration token
" Token recived: eCBFY_IAapw:APA91bGocEz6TDkR6pl1zz9JI8mC1JKbOY9QwXiW6JhPrkJaeELTq-VJRDhAnnORJkTlLp4fXrxElet71kj3hjBFdkGPFMnuga3BCiH8wWBnzEe3tKTMt8VNJq1rf9m6QqvoPTiWk1BS"
2017-12-06 14:11:48.377603+0330 Project[3185:968763] FCM: Connected to FCM
2017-12-06 14:11:49.151582+0330 Project[3185:968895] TIC Read Status [1:0x0]: 1:57
2017-12-06 14:11:49.152354+0330 Project[3185:968895] TIC Read Status [1:0x0]: 1:57
2017-12-06 14:11:56.226105+0330 Project[3185:968763] FCM: Received message
2017-12-06 14:11:58.065572+0330 Project[3185:968763] FCM: Received message
2017-12-06 14:12:03.458103+0330 Project[3185:968763] FCM: Disconnect FCM service

I pressed home button 

nothing ....

Back to app

2017-12-06 14:12:03.893158+0330 Project[3185:969067] TIC Read Status [3:0x0]: 1:57
2017-12-06 14:12:03.894013+0330 Project[3185:969067] TIC Read Status [3:0x0]: 1:57
2017-12-06 14:12:11.520373+0330 Project[3185:968763] FCM: Connected to FCM
2017-12-06 14:12:12.220608+0330 Project[3185:968763] FCM: Received message

Finally I resolved the problem
Please edit files in example
1- add
screen shot 2017-12-06 at 5 09 10 pm
2-
screen shot 2017-12-06 at 5 12 08 pm
3- Add UserNotifications framework !important

LIBS += \
    -framework StoreKit \
    -framework Security \
    -framework SystemConfiguration \
    -framework UserNotifications \

**4- Remove this section from plist file **

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

Worked like charm ;-)

@stewartmiles - looks like a false alarm then - sorry :)

@cinohee - Awesome. Can you add exactly that post you just made to the QtFirebase issue as well (for reference - until I get to update the example)?

@larpon I added the post :)