【发布时间】:2013-06-11 03:58:23
【问题描述】:
所以我正在尝试设置 PhoneGap IOS 和 Parse.com 推送通知应用程序。我正在使用这个插件https://github.com/mgcrea/cordova-push-notification 向苹果注册设备并取回设备令牌。现在我需要将该数据保存到 Parse 上的 Installition 类。问题是当我保存时它会创建一个新的安装类。
var Installation = Parse.Object.extend("Installation");
var installation = new Installation();
installation.save({badge: status.pushBadge, deviceToken: status.deviceToken, deviceType: status.type, installationId: appID}, {
success: function(response){
alert("seccuees " + response);
},
error: function(error){
alert("error " + error.message);
}
});
我也尝试过使用 ajax 调用其余 api 并且不行..
$.ajax({
type: 'GET',
headers: {'X-Parse-Application-Id':'miid','X-Parse-Rest-API-Key':'myid'},
url: "https://api.parse.com/1/installations",
data: {"deviceType": "ios", "deviceToken": "01234567890123456789", "channels": [""]},
contentType: "application/json",
success: function(response){
alert("Success " + response);
},
error: function(error){
alert("Error " + error.message);
}
});
【问题讨论】:
-
你能告诉我android的代码吗?
标签: ios cordova parse-platform