Pre*_*ari 1 cordova ionic-framework cordova-plugins ionic-native ionic5
我正在为我的应用程序构建推送通知,但是当我在设备上运行我的应用程序时,我收到以下错误:
vendor-es2015.js:101693 Native: tried calling FCM.getToken, but the FCM plugin is not installed.
pluginWarn @ vendor-es2015.js:101693
vendor-es2015.js:101699 Install the FCM plugin: 'ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated'
pluginWarn @ vendor-es2015.js:101699
vendor-es2015.js:101693 Native: tried calling FCM.onNotification, but the FCM plugin is not installed.
pluginWarn @ vendor-es2015.js:101693
vendor-es2015.js:101699 Install the FCM plugin: 'ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated'
pluginWarn @ vendor-es2015.js:101699
vendor-es2015.js:101693 Native: tried calling FCM.onTokenRefresh, but the FCM plugin is not installed.
pluginWarn @ vendor-es2015.js:101693
vendor-es2015.js:101699 Install the FCM plugin: 'ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated'
pluginWarn @ vendor-es2015.js:101699
vendor-es2015.js:72492 Angular is running in the development mode. Call enableProdMode() to enable the production mode.
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:175 OPEN database: _ionicstorage
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:106 new transaction is queued, waiting for open operation to finish
vendor-es2015.js:43427 ERROR Error: Uncaught (in promise): plugin_not_installed
at resolvePromise (polyfills-es2015.js:4153)
at resolvePromise (polyfills-es2015.js:4110)
at polyfills-es2015.js:4214
at ZoneDelegate.invokeTask (polyfills-es2015.js:3747)
at Object.onInvokeTask (vendor-es2015.js:73280)
at ZoneDelegate.invokeTask (polyfills-es2015.js:3746)
at Zone.runTask (polyfills-es2015.js:3524)
at drainMicroTaskQueue (polyfills-es2015.js:3915)
defaultErrorLogger @ vendor-es2015.js:43427
main-es2015.js:2538 response -> HttpResponse
2vendor-es2015.js:43427 ERROR plugin_not_installed
defaultErrorLogger @ vendor-es2015.js:43427
Run Code Online (Sandbox Code Playgroud)
您可以看到下面的插件已安装,但我仍然遇到相同的错误。我尝试再次卸载并安装它,我再次删除并添加了平台,但仍然出现相同的错误。
下面是 Ionic Info 命令的输出:
Ionic:
Ionic CLI : 6.1.0 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.2.2
@angular-devkit/build-angular : 0.803.27
@angular-devkit/schematics : 9.1.9
@angular/cli : 8.3.27
@ionic/angular-toolkit : 2.2.0
Capacitor:
Capacitor CLI : 1.5.0
@capacitor/core : 1.5.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0, browser 6.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 13 other plugins)
Utility:
cordova-res (update available: 0.15.1) : 0.11.0
native-run (update available: 1.0.0) : 0.3.0
System:
NodeJS : v10.15.1 (/usr/local/bin/node)
npm : 6.11.3
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
ionic cordova plugin list
> cordova plugin ls
com-sarriaroman-photoviewer 1.2.4 "PhotoViewer"
com.razorpay.cordova 0.16.1 "RazorpayCheckout"
cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-plugin-androidx-adapter 1.1.1 "cordova-plugin-androidx-adapter"
cordova-plugin-cocoapod-support 1.6.2 "Cordova CocoaPods Dependency Support"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-fcm-with-dependecy-updated 7.0.0 "Cordova FCM Push Plugin"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.6.5 "SocialSharing"
cordova-sqlite-storage 5.0.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
cordova-support-android-plugin 1.0.2 "cordova-support-android-plugin"
cordova-support-google-services 1.4.1 "cordova-support-google-services"
es6-promise-plugin 4.2.2 "Promise"
Run Code Online (Sandbox Code Playgroud)
对于 Ionic 5 应用程序,根据此处cordova-plugin-fcm-with-dependecy-updated的文档,该插件的使用方式应与 Ionic 4 略有不同。
对于我的 Ionic 5 应用程序,我只是将它导入app.component.ts如下(即作为工厂类):
import { FCM } from "cordova-plugin-fcm-with-dependecy-updated/ionic";
并在平台准备好时使用它:
platform.ready().then(() => {
// Some code ..
FCM.getToken().then(token => {
console.log(token);
}, error => { console.log(error) });
// More code ..
});Run Code Online (Sandbox Code Playgroud)
此外,根据此插件的文档,不再需要该@ionic-native/fcm包。但是,我还没有在 IOS 上测试过这个。
| 归档时间: |
|
| 查看次数: |
2136 次 |
| 最近记录: |