我用git克隆一个项目,该项目是用离子2创建的,但当我执行命令重新创建node_modules文件夹时,我得到了这个错误.
npm install
npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
npm ERR! code ETARGET
npm ERR! notarget No matching version found for ionic-native@^3.5.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'ionic-hello-world'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! …Run Code Online (Sandbox Code Playgroud) 我正在使用一个用于我在Ionic 2中开发的应用程序的信号插件,该插件正在运行.从OneSignal发送的消息显示在应用程序中,但是当我尝试获取播放器唯一ID时出现问题:
这是我用于显示消息的代码,此代码有效:
let notificationOpenedCallback = function(jsonData) {
let alert =alertCtrl.create({
title: jsonData.notification.payload.title,
subTitle: jsonData.notification.payload.body,
buttons: ['OK']
});
alert.present();
console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
};
window["plugins"].OneSignal
.startInit("05d411f4-45da-4101-92a5-4a60e5c9fd03", "49543248748")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
Run Code Online (Sandbox Code Playgroud)
这段代码用于获取ID:
window["plugins"].OneSignal
.startInit("05d411f4-45da-4101-92a5-4a60e5c9fd03", "49543248748")
.endInit();
window["plugins"].OneSignal.getIds(function(ids){
firebase.database().ref('usuarios/'+ this.usuarioId).update({
idOnesignal: ids.userId
})
Run Code Online (Sandbox Code Playgroud)
这段代码不会运行