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.build/Debug-iphonesimulator/sampleapp.build/Objects-normal/i386/CDVFile.o sampleapp/Plugins/org.apache.cordova.file/CDVFile.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/sampleapp.build/Debug-iphonesimulator/sampleapp.build/Objects-normal/i386/CDVLocalFilesystem.o sampleapp/Plugins/org.apache.cordova.file/CDVLocalFilesystem.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/sampleapp.build/Debug-iphonesimulator/sampleapp.build/Objects-normal/i386/CDVAssetLibraryFilesystem.o sampleapp/Plugins/org.apache.cordova.file/CDVAssetLibraryFilesystem.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/sampleapp.build/Debug-iphonesimulator/sampleapp.build/Objects-normal/i386/CDVSound.o sampleapp/Plugins/org.apache.cordova.media/CDVSound.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(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

then

cordova platform update ios