zo0r / react-native-push-notification

React Native Local and Remote Notifications
MIT License
6.73k stars 2.05k forks source link

Not receiving remote notifications to device. #703

Closed densk1 closed 6 years ago

densk1 commented 6 years ago

"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

What I've done and double checked

densk1 commented 6 years ago

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.