简体   繁体   English

Ionic / Cordova插件不包含在Xcode项目中

[英]Ionic/Cordova Plugins not included in Xcode project

I have a Ionic v1 project and I have an issue when building on ios. 我有一个Ionic v1项目,在构建ios时遇到问题。 Almost all of my cordova plugins are not added in the Xcode project in the left column under the folder plugin. 几乎所有的cordova插件都没有添加到文件夹插件下左栏的Xcode项目中。 Cordova version : 6.2.0 Xcode version : 8.3.3 Cordova版本:6.2.0 Xcode版本:8.3.3

I have done : 我已经做好了 :

cordova platforms rm ios
cordova platforms add ios
cordova build ios

It compiles fine but the plugin files are not added in my Xcode project (when I run the app, I have a lot of XXXPlugin class CDVXXXX (pluginName: XXX) does not exist). 它编译得很好但插件文件没有添加到我的Xcode项目中(当我运行应用程序时,我有很多XXXPlugin类CDVXXXX(pluginName:XXX)不存在)。

  • The plugin files are added in the platforms/ios/MyProject/Plugins (I can see the different folders and the files .h et .m). 插件文件添加在platforms / ios / MyProject / Plugins中(我可以看到不同的文件夹和文件.h et .m)。
  • But when I open the Xcode project, there are only the files of one of my plugins (Branch.io), all the others are not here (cordova-plugin-camera, cordova-plugin-geolocation, cordova-plugin-inappbrowser, etc.) 但是当我打开Xcode项目时,只有我的一个插件(Branch.io)的文件,所有其他插件都不在这里(cordova-plugin-camera,cordova-plugin-geolocation,cordova-plugin-inappbrowser等等) 。)
  • In my config.xml, seems ok (example : <plugin name="cordova-plugin-geolocation" spec="~2.4.3" /> ) 在我的config.xml中,似乎没问题(例如: <plugin name="cordova-plugin-geolocation" spec="~2.4.3" />
  • In platforms/ios/MyProject/config.xml, seems ok as well (example : <feature name="Geolocation"><param name="ios-package" value="CDVLocation" /></feature> ) 在platforms / ios / MyProject / config.xml中,似乎还可以(例如: <feature name="Geolocation"><param name="ios-package" value="CDVLocation" /></feature>

I could add them manually but it takes time and every time I remove and re-add platform, I would have to do it again. 我可以手动添加它们,但这需要时间,每次我删除并重新添加平台时,我都必须再次执行此操作。

I don't know what to do, any ideas of what I'm doing wrong ? 我不知道该怎么办,对我做错了什么想法? Why is XCode stopping importing plugin files after the first one (BranchSDK which appears to be the first one in alphabetical order by the way) ? 为什么XCode会在第一个之后停止导入插件文件(BranchSDK看起来是按字母顺序排列的第一个)?

My package.json : 我的package.json:

{
   "name": "myapp",
   "version": "1.1.1",
   "description": "myapp: An Ionic project",
   "dependencies": {
       "grunt-contrib-compress": "^1.3.0",
       "grunt-contrib-uglify": "^2.0.0",
       "gulp": "^3.5.6",
       "gulp-concat": "^2.2.0",
       "gulp-minify-css": "^0.3.0",
       "gulp-rename": "^1.2.0",
       "gulp-sass": "^2.0.4",
       "ionic-native-transitions": "^1.0.2",
       "moment": "^2.14.1",
       "ng2-translate": "^2.2.2",
       "plist": "^2.0.1"
    },
    "devDependencies": {
       "angular-translate": "^2.15.2",
       "bower": "^1.3.3",
       "coffee-script": "^1.10.0",
       "grunt-contrib-compress": "^1.3.0",
       "grunt-contrib-uglify": "^2.0.0",
       "gulp-angular-templatecache": "^2.0.0",
       "gulp-ng-annotate": "^2.0.0",
       "gulp-useref": "^3.1.2",
       "gulp-util": "^2.2.14",
       "mv": "^2.1.1",
       "shelljs": "^0.3.0"
    },
    "cordovaPlugins": [
       "cordova-plugin-whitelist",
       "cordova-plugin-console",
       "cordova-plugin-device",
       "cordova-plugin-splashscreen",
       "ionic-plugin-keyboard",
       "cordova-plugin-network-information",
       "cordova-plugin-geolocation",
       "cordova-plugin-badge"
    ],
    "cordovaPlatforms": [
       "android",
       {
         "platform": "ios",
         "version": "4.1.1",
         "locator": "ios@4.1.1"
       }
     ]
}

Thanks 谢谢

Cordova version : 6.2.0 Cordova版本:6.2.0

cordova@6.2.0 was released over 1½ years ago. cordova@6.2.0 一年半前发布 Try updating to the latest version cordova@7.1.0 尝试更新到最新版本cordova@7.1.0

Then install the latest iOS platform: cordova platform add ios@latest 然后安装最新的iOS平台: cordova platform add ios@latest

Xcode version : 8.3.3 Xcode版本:8.3.3

While you're at it, update to Xcode 9 so you can build for iOS 11 / iPhone X. 在您使用它时,请更新到Xcode 9,以便为iOS 11 / iPhone X构建。

delete plugins folder, node_module folder and platform/ios folder. 删除插件文件夹,node_module文件夹和platform / ios文件夹。 Then run "npm install in the project root. The add ios platform 然后在项目根目录中运行“npm install。添加ios平台

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM