我正在开发一个科尔多瓦(3.4.0)的安卓和iOS的应用程序。我正在整合城市飞艇推送通知。我正在从服务器发送额外的推送消息和url。在android中,推送消息和附加功能正常,但在iOS中我收到的是空的附加功能。我正在关注城市飞艇phonegap文档http://docs.urbanairship.com/build/phonegap.html
接收推送和附加服务的代码
var handleIncomingPush = function(event) {
if(event.message) {
console.log("Incoming push: " + event.message)
//alert(event.message);
} else {
console.log("No incoming message")
}
if(event.extras.url) {
console.log("URL")
window.open(event.extras.url,'_blank','location=no,closebuttoncaption=Done,toolbar=yes,toolbarposition=bottom');
}
}Playload是
Payload: {"aliases":["alias_xssh"],"aps":{"badge":"+1","extra":{"url":"http:\/\/jhe.com\/task.php?action=daily&username=ins-mobile&date=2014-05-12"},"alert":"This is subject"}在xcode中接收日志时,日志是
aps = {
alert = "This is subject";
badge = 16;
extra = {
url = "http://jhe.com/task.php?action=daily&username=ins-mobile&date=2014-05-12";
};
};
2014-05-13 20:00:36.072 ListCreator[974:60b] {"message":"This is subject","extras":{}}问题在最后一行。extras:{} is empty。同样的代码可以在Android中正常运行,但在iOS中不能获得额外的功能。
任何建议都将受到高度赞赏。
谢谢
发布于 2014-06-02 08:46:41
有效负载应该是这样的
Payload: "aps": {"alert": "This is subject", "badge": 1}, "url": "http:\/\/jhe.com\/task.php?action=daily&username=ins-mobile&date=2014-05-12"
console.log(event.extras.url);希望这能有所帮助
https://stackoverflow.com/questions/23633720
复制相似问题