我正在尝试back4app用于推送通知。为此,我已经像这样安装了back4appionic sdk ( https://www.back4app.com/docs/ionic/parse-ionic-sdk )
npm install parse
然后在我app.component.ts导入的解析中
import Parse from 'parse';
并在平台准备好
Parse.serverURL = "https://parseapi.back4app.com/";
Parse.initialize("APP_ID_HERE", "JAVASCRIPT_KEY"); //I have used real keys from back4app dashboard.
let install = new Parse.Installation();
install.save(null, {
success: (install) => {
// Execute any logic that should take place after the object is saved.
// console.clear();
console.error('New object created with objectId: ' + install.id);
},
error: (install, error) => {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
//console.clear();
console.error('Failed to create new object, with error code:' + error.message.toString());
}
});
当我在设备中进行 Ionic 服务或测试时,它应该将设备/安装 ID 注册到他们的后端,但它给出400 Bad Request error on https://parseapi.back4app.com/classes/_Installation的错误是 -
{"code":135,"error":"deviceType must be specified in this operation"}
我不确定在哪里提及deviceType,因为他们的文档似乎不太好。
有人可以帮我吗?