我正在使用Javascript SDK和Appccelerator Titanium。 Javascript SDK没有保存deviceToken以启用推送的功能。我尝试了各种方法,但应该工作的方法(不是)通过云功能保存。我做错了什么?
Parse.Cloud.define("subscribeToPush", function(request, response) {
Parse.Cloud.useMasterKey();
var Installation = Parse.Object.extend("Installation");
var membership = new Installation();
membership.set("deviceType", request.params.os);
membership.set("deviceToken", request.params.deviceToken);
membership.set("channels", ["general"]);
membership.save(null,{
success:function(membership) {
response.success(membership);
},
error:function(error) {
response.error(error);
}
});
});
运行此功能后,Cloud Log显示它已创建,但我在数据浏览器中看不到它。
I2014-10-22T01:29:30.319Z] v51: Ran cloud function subscribeToPush for user rCzHEXY5hN with:
Input: {"deviceType":"ios","deviceToken":"xxxXXXxxx","channels":["general"]}
Result: {"deviceToken":"xxxXXXxxx","channels": "general"],"objectId":"KCWtpcwy4i","createdAt":"2014-10-22T01:29:30.383Z","updatedAt":"2014-10-22T01:29:30.383Z","__type":"Object","className":"Installation"}