我试图用推送通知,所以我使用onesignal “遗漏的类型错误:在使用此我得到这个错误不能读取属性‘OneSignal’的未定义
"Uncaught TypeError: Cannot read property 'OneSignal' of undefined"
代码:。
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Enable to debug issues.
// window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
window.plugins.OneSignal.init("AIzaSyCkgXtEUurHrM5rYUmstQmL7s8HkA6OTpA", {googleProjectNumber: "583817643699"}, notificationOpenedCallback);
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.enableInAppAlertNotification(true);
});
})
普莱舍帮助我找到好的解决办法
检查设备是否准备就绪。在设备就绪事件被调用之后,您才可以使用任何插件。 –