Closed pop42 closed 8 years ago
This is from the documentation for apnagent
.alert (key, value)
@param{ String | Object }alertbody, string key or object of alert settings
@param{ Mixed }value(when first argument is a string)
@return{this} for chaining
Sets variables to be included in the alert dictionary for the aps portion of the payload. If you wish to set a singlular message, set the body key. You may also set any of the other values outlined in the APNS documentation and the codecs will optimize the payload format for delivery.
Allowed keys:
body
action-loc-key
loc-key
loc-args
launch-image
if you notice in the above list, title is not listed as one of the available keys.
but on this page from apple : https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html in table 5.2, you will see title is one of apple's accepted keys from alert.
I tested sending .alert({"body":"some body text", "title": "some title"})
and the body went... the title didn't.
I needed it for this project I am on, so I quickly had to change to another library (apn), but I would prefer to use apnagent if just because the documentation is so snazzy.
I know I've been using it in my project, but I have to admit I may not have committed that to everyone. I'll let you know in the morning when I'm at a computer that has all my resources
The complete set was committed last July https://github.com/ExploreMqt/apnagent/commit/00e71c3ec8d714e41421e32d7acea6df4dd38590
Not works when I use a title attribute in the alert json.
agent.createMessage()
.device("f2bd91c92dc8de2d67ba064eddce483e5f843ed4143456c3cde46dd99fd3dbfa")
.alert({
"title": "Push Test",
"body": "Hello"
})
.sound("default")
.send(function (err) {
if (err) {
console.log("[cb] If you se me something went terribly wrong.");
} else {
console.log("Success");
}
});
Can you elaborate or provide a snippet demonstrating your problem?