When my app is on background and I receive a remote notification, two things can happen:
I tap on the push notification banner, my apps comes to foreground and didReceiveRemoteNotification is called.
I tap on my app icon from the springboard, my app comes to foreground and didReceiveRemoteNotification IS NOT called.
So, in the scenario 1, I can update my counter of unread messages inside the app in response to didReceiveRemoteNotification. In the scenario 2, I can't.
How can I solve this using Quickblox?
The issue is probably that
application:didReceiveRemoteNotification:
is not called if the app is not running. To quote Apple documentation:This document is outdated
This is the new document
As one possible variant:
You have to enable Remote Notifications in the Background Modes.
To do so, automatically: (Xcode5)
To do so, manually:
Be sure to use these methods frankWhite used :)
Hope this helps ;)
When app is not running, in didFinishLaunchingWithOptions: you can use this code for get push's payload:
Remember to set permission in plist
For the remote push you can use in your appdelegate: