Not receiving remote notifications to device.
"react-native": "0.55.0",
Tried on both IOS 11.2.6 and iOS 10.3.1.
Using both Xcode 9.1 and 9.3
I can get the devices to trigger local notifications, but I can't deliver to a device remotely. The device is plugged in via USB and I'm building the application from Xcode to the device.
I'm sending notifications from a simple node server to APNs and receiving success messages.
{ regId:
{ device: '0000000aaaaaaaaaa1111111111bbbbbbbbb' },
error: null }
[ { method: 'apn', success: 1, failure: 0, message: [ [Object] ] } ]
Things I've tried
- Deleting the App from the device and rebuilding to the device. This invokes a new permission request and I'm updating the new key on the server each time.
- Tried two different devices
What I've done and double checked
- [x] Enabling 'Remote Notifications' in Capabilities > Background Modes
- [x] Enabling 'Push Notifications' in Capabilities
- [x] Manually installed
PushNotificationsIOSfrom RN docs here - [x] Manually added RCTPushNotification.xcodeproj to my Xcode project from node_modules
- [x] Added libRCTPushNotification.a to 'Link Binary to Libraries
Ok solved,
I started looking at the device console in Xcode and found that the device was receiving the notifications, however, it wasn't passing them on because it didn't see alert, badge, or sound in the notification object.
Server side, I'm using node-pushnotifications Rather than using the data object verbatim from the docs I removed everything and started re-adding items into it one by one.
data: {
topic: "com.domain.myapp",
title: 'Message Title',
body: 'This is the message body',
badge: 2,
sound: 'default',
}
While the issue wasn't relevant to this repo, I wanted to document it, in case it comes up in search results.