没有cordova插件使用离子原生的离子3 ios项目

问题描述 投票:0回答:1

当前行为:所有插件都无法从.ts文件中调用插件,如果调用插件,则表示Ionic Native:尝试调用StatusBar.styleDefault,但未安装StatusBar插件。

预期的行为:插件应该像https://ionicframework.com/docs/v3/native/中提到的那样工作

重现步骤:

没有用于ionic3 ios项目的离子原生物的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"
    ]
  }
}

相关代码:

其他信息:

离子信息:(从终端/命令提示符运行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 ([email protected])
   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
cordova ionic3 ionic-native
1个回答
0
投票

运行ionic cordova platform remove ios然后ionic cordova platform add ios。您的插件似乎处于不一致状态,删除和添加平台应解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.