没有适用于ionic3 ios项目的与ionic-native兼容的cordova插件

时间:2019-02-22 06:59:30

标签: cordova ionic3 ionic-native

当前行为: .ts文件无法调用任何插件 对于所有插件,如果您调用插件,则会显示 离子本机:尝试调用StatusBar.styleDefault,但未安装StatusBar插件。

预期的行为: 插件应该像在 https://ionicframework.com/docs/v3/native/

复制步骤:

没有适用于ionic3 ios项目的与ionic-native兼容的cordova插件 如下使用package.json

{
  "name": "HelloWorld",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "^7.2.6",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "^4.20.0",
    "@ionic-native/device": "^4.20.0",
    "@ionic-native/file": "^4.20.0",
    "@ionic-native/file-chooser": "^4.20.0",
    "@ionic-native/file-opener": "^4.20.0",
    "@ionic-native/file-path": "^4.20.0",
    "@ionic-native/file-transfer": "^4.20.0",
    "@ionic-native/http": "^4.20.0",
    "@ionic-native/network": "^4.20.0",
    "@ionic-native/splash-screen": "^4.20.0",
    "@ionic-native/sqlite": "^4.20.0",
    "@ionic-native/status-bar": "^4.20.0",
    "@ionic/storage": "2.2.0",
    "cordova-android": "7.1.4",
    "cordova-ios": "4.5.5",
    "cordova-plugin-advanced-http": "2.0.4",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-file": "6.0.1",
    "cordova-plugin-file-opener2": "2.2.0",
    "cordova-plugin-file-transfer": "1.7.1",
    "cordova-plugin-filechooser": "1.2.0",
    "cordova-plugin-filepath": "1.5.1",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^3.1.2",
    "cordova-plugin-network-information": "2.0.1",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "3.1.0",
    "ionic-angular": "3.9.3",
    "ionicons": "3.0.0",
    "moment": "^2.24.0",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.29"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.2",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-advanced-http": {},
      "cordova-plugin-device": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-opener2": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-filechooser": {},
      "cordova-plugin-filepath": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

相关代码:

其他信息:

离子信息:(从终端/ cmd提示符运行ionic info,并在下面粘贴输出):



Ionic:

   ionic (Ionic CLI)  : 4.10.3 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.3
   @ionic/app-scripts : 3.2.2

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 11 other plugins)

System:

   ios-deploy : 1.9.4
   NodeJS     : v10.15.0 (/usr/local/bin/node)
   npm        : 6.7.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.1 Build version 10B61

1 个答案:

答案 0 :(得分:0)

Run ionic cordova platform remove ios then ionic cordova platform add ios. It seems your plugins are in an inconsistent state and removing and adding the platform should resolve that.