gpt4 book ai didi

ios - Phonegap 和 Parse.com 推送通知 IOS

转载 作者:行者123 更新时间:2023-11-29 13:11:49 25 4
gpt4 key购买 nike

所以我正在尝试设置 PhoneGap IOS 和 Parse.com 推送通知应用程序。我正在使用这个插件 https://github.com/mgcrea/cordova-push-notification 向苹果注册设备并取回设备 token 。现在我需要将该数据保存到我的 Parse 上的安装类。问题是当我保存时它会创建一个新的安装类。

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);
}
});

最佳答案

不要使用“安装”类。它只会创建一个新的 Installation 对象。要为推送通知创建解析安装对象,请使用“_Installation”。以下是实现方法。

var installation = new  Parse.Object("_Installation");;
installation.save({ channels: ['channelName'], deviceType: "android", installationId: id}, {
success: function(response){
alert("success " + response);
},
error: function(error){
alert("error " + error.message);
}
});

关于ios - Phonegap 和 Parse.com 推送通知 IOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17109548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com