Ios build failure after adding media plugin

After I added the cordova media plugin, I see these compile errors on ionic build ios
The plugin was added after adding the ios platform.

The following build commands failed: 
CompileC build/ sampleapp/Plugins/org.apache.cordova.file/CDVFile.m normal i386 objective-c
CompileC build/ sampleapp/Plugins/org.apache.cordova.file/CDVLocalFilesystem.m normal i386 objective-c
CompileC build/ sampleapp/Plugins/org.apache.cordova.file/CDVAssetLibraryFilesystem.m normal i386 objective-c
CompileC build/ sampleapp/Plugins/ normal i386 objective-c
(4 failures)
Error: /Users/myuser/project/ionic/sampleapp/platforms/ios/cordova/build: Command failed with exit code 65
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23) 
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)

I’ve seen this before, it’s an issue with cordova-cli build.

Remove the platform and and it back. That should take care of things

Removing and adding platform again did not worked for me but, updating the made it working.

Firstly I upgraded cordova CLI

sudo npm update -g cordova


cordova platform update ios