0
我正在撞墙,因为我找不到为什么我的推送通知不起作用。当保存推送通知标记时,Ionic V1:错误404
一个小版本列表:
$ cordova plugin info
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-splashscreen 4.0.1 "Splashscreen"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.8.4 "PushPlugin"
$ ionic info
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v5.12.0
Xcode version: Not installed
是注册的推送系统代码:
// In config
$ionicCloudProvider.init({
core: {
app_id: "xxxx"
},
push: {
sender_id: "yyyyyy",
pluginConfig: {
ios: {
badge: true,
},
android: {
iconColor: "#343434"
}
}
}
});
// In controller
// Register Push notifications
$ionicPush.register().then(function (t) {
console.log('register successfull', t);
return $ionicPush.saveToken(t, {
ignore_user: true
});
}).then(function (t) {
console.log('Token saved:', t);
alert('Token saved:', t.token);
});
我与USB Android手机调试,具有:
ionic run android
然后我检查与铬设备检查器,看看发生了什么。 事情是,该“注册全成”出现,具有“正确的”令牌
{
"token": "fWjLt4mOttw:APA91bE4KCycHlu92T6fJTzMFbRFtJdTUrb2u9jv5LTO2yTPD_-sKshbqo93UStwjdJpmLun2tJBCgegaUYnlj9kxxFWFPi9hobZH5W80OnrsPdfxrdYNmp8SYM_SXp-5RiknFrbPl5l",
"app_id": "XXXXXX"
}
但saveToken方法失败,404错误。当我与重播卷曲请求在我的壳(点击右键>复制>的卷曲),我没有任何错误...这里是铬控制台日志:
POST https://api.ionic.io/push/tokens 404 (Not Found)
Ionic Push: Error: Not Found
at q.<anonymous> (app.js:formatted:717)
at q.t.emit (app.js:formatted:9164)
at XMLHttpRequest.n.onreadystatechange (app.js:formatted:9424)
下面是卷曲的输出(似乎正确)
{
"meta": {
"status": 201,
"version": "2.0.0-beta.0",
"request_id": "92487e15-9f2a-416f-c15b-9129e9e10049"
},
"data": {
"token": "fWjLt4mOttw:APA91bE4KCycHlu92T6fJTzMFbRFtJdTUrb2u9jv5LTO2yTPD_-sKshbqo93UStwjdJpmLun2tJBCgegaUYnlj9kxxFWFPi9hobZH5W80OnrsPdfxrdYNmp8SYM_SXp-5RiknFrbPl5l",
"type": "android",
"invalidated": null,
"valid": true,
"created": "2017-03-07T16:43:58.993190+00:00",
"app_id": "f2de99a1",
"id": "c85e1bdbb6b3cf2da8f090ba59df6892"
}
}
任何人都可以帮助我吗? 谢谢!