Ionic/Cordova Plugins not included in Xcode project

Viewed 1244

I have a Ionic v1 project and I have an issue when building on ios. Almost all of my cordova plugins are not added in the Xcode project in the left column under the folder plugin. Cordova version : 6.2.0 Xcode version : 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).

  • The plugin files are added in the platforms/ios/MyProject/Plugins (I can see the different folders and the files .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.)
  • In my config.xml, seems ok (example : <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>)

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) ?

My 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

2 Answers

Cordova version : 6.2.0

cordova@6.2.0 was released over 1½ years ago. Try updating to the latest version cordova@7.1.0

Then install the latest iOS platform: cordova platform add ios@latest

Xcode version : 8.3.3

While you're at it, update to Xcode 9 so you can build for iOS 11 / iPhone X.

delete plugins folder, node_module folder and platform/ios folder. Then run "npm install in the project root. The add ios platform

Related