Adding plugins breaks build


#1

I’ve read others posts and people are having similar issues after adding plugins using

cordova add plugin [plugin_name]

The error is happens when you do

cordova add plugin [plugin_name]

and then

ionic build ios

I realized thhe plugins aren’t being copied into the following directory:

[app]/platforms/ios/[app]/Plugins

I solve this by copying just the necessary *.h and *.m files with the corresponding folder name.

Is this a cordova or ionic thing?

Similar issue: Cordova splashscreen plugin breaks ios build


#2

As a beginner in ionic / Cordova, I had the same problem. It seems that when you add a plugin, it need to be installed in the platform also.
I solved it to remove platform and add it again.

ionic platform rm ios
Ionic platform add ios

but it creates other problems, losing customized icons and splash screens in the platform.
One can consider using hooks

http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/

If there is a better way, please let me know

Anders


#3

I had the same problem with the SplashScreen plugin and solved by removing the Plugin’s files in Xcode, then re-adding the plugin via cordova plugin add.
This way I hadn’t to remove and add again the platform, keeping icons and splash screens.


#4

@nypan

I solved the problem of icons and splashes by created a shell script that sets up my project and makes sure that all the plugins and OSs are installed, then it add the icons and splashes to the correct places before running

cordova build

So now I just run buildCordova.sh and it sets up everything and builds for me. My boss is a big fan of being able to do a pull, run one script and have everything working. It is a nice practice to follow


#5

@meiding sounds awesome. Could you share this script?


#6

Here is the script setupCordovaProject: http://pastebin.com/mMt9fu50

and this is buildCordova: http://pastebin.com/XYGVbMqX

Build cordova calls setup and then for us it applies a patch for an iOS problem we had. If anyone has any other ideas for this please feel free to share


#7

Just wanted to add that this did the trick for me. Fortunately, we had not added icons and splash screens yet.