I am trying to use Firebase
for push notification. i have successfully installed the Firebase
And Firebase messaging
via Cocoapods
you need to create an App ID in your developer account that has the push notification entitlement enabled. Luckily, Xcode has a simple way to do this. Go to App Settings -> Capabilities and flip the switch for Push Notifications to On. After some loading, it should look like this: push notifications
Also check p12 certificate is set for Firebase as it uses .p12 certificate for push notifications.
You must call [[UIApplication sharedApplication] registerForRemoteNotifications];
to properly register for remote notifications.
Configuring Remote Notifications For Background Usage
Have you configured your app's background modes to accept remote notifications? You can do this by clicking: Project Name -> Capabilities -> Background Modes
Turn this on and then tick the box beside Remote Notifications as seen in the screenshot below.
You should be calling (iOS 8+) registerForRemoteNotifications
, not isRegisteredForRemoteNotifications
.
Otherwise, you'll never get "high priority" messages from the Firebase server, delivered natively using APNS.
Please note that when you're running in XCode, you are running in sandbox mode, so be sure to register with the proper parameters.
Try sending it in "high priority" and see if your payload is in the proper APNS format:
{
"aps" : {
"alert" : "You got your emails.",
"badge" : 9,
"sound" : "bingbong.aiff"
},
}
Note that your payload may have =
instead of :
, which is acceptable.