Closed densk1 closed 6 years ago
Hello @densk1, thank you for your feedback! Do you by any chance know which field(s) in the payload caused the trouble with APNS? Do you have any additional error messages? Then we could potentially adjust the documentation accordingly.
Cheers
I copy pasted the full object from the docs, so while I'm not sure off hand, I think it was caused by having an empty alert: {}
key in my data
object.
I'm happy to do a conclusive test this week and submit a PR tweak for docs if it helps.
I would greatly appreciate that! Thank you! :)
Ok, I've recreated this on IOS 11.3 iPhone 7.
Using the object as is in the docs, adding only a topic
value, you get an error that is roughly the following in the device console.
No values for, badge, sound, or alert, not notifying com.example.app
Excuse the roughness, I haven't the test device at home here, just a development build/install on my own device, so can't see device console.
Is that true?
No, In the object from docs both badge and sound have values. and alert: { }
is an empty object.
What fixed it?
mdm: ' ', // apn and gcm for ios
makes the device vibrate but no notification visibly appears.alert: { }
is an empty object if // alert
is commented out, notification appears.Suggestion Is it worth commenting out the mdm line as a default, and adding the following in docs?
alert: { } // apn, will take precedence over title and body.
// Your notification won't appear on ios if alert is empty object
// If alert is an empty string 'title' and 'body' will show in Notification
// mdm: '' // (Mobile Device Management) apn and gcm for ios
@densk1 Thank you for this research. I will do some more digging because there are ongoing discussions regarding the support of silent push notifications (https://github.com/appfeel/node-pushnotifications/issues/56), which you seem to have got working.
I will also look into the mdm
parameter and update the docs accordingly once I have some more insight
Ok great,
Here is a complete list of the device console output when I send the push notification with the un-edited data
object.
default 10:05:22.464385 +0100 SpringBoard Received incoming message on topic com.domain.myapp at priority 10
default 10:05:22.465978 +0100 SpringBoard [com.domain.myapp] Received remote notification request B910-1D51 [ hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 0 hasMutableContent: 0 ]
default 10:05:22.466121 +0100 SpringBoard [com.domain.myapp] Deliver push notification request B910-1D51
error 10:05:22.466266 +0100 SpringBoard Ignoring notification with no alert, sound or badge (com.domain.myapp): B910-1D51
default 10:05:22.466391 +0100 SpringBoard [com.domain.myapp] Not saving push notification B910-1D51 to store [ error=Error Domain=UNErrorDomain Code=1401 "Notification has no user-facing content" UserInfo={NSLocalizedDescription=Notification has no user-facing content} ]
I don't think I had silent notifications working, as the device is actually vibrating/beeping, just without a visible notification showing up because alert: {}
is empty. (With // mdm: ''
commented out)
Also .onNotification();
isn't been called.
Hi @densk1 , I added your suggestions for improving the README in e8c684a. Thank you for your input!
Hello, for our cordova apps we had problems with phonegap: true not receiving pn on ios.
Hello, could you please provide more details? Are there any logs or code you can provide?
I had an issue whereby the Notification was sending through APNS, but that there was no sign of it appearing on my device.
I wanted to reference it here, as it may be valuable to someone in the future.
My issue was that I used the whole example
data
object from the push example in the docs3. Create a JSON object with a title and message and send the notification.
What solved it was using the bare minimum in the data object like so.