2014-11-23 94 views
4

我正在開發一個使用Ionic Framework和Cordova的移動應用程序,我試圖在Cordova媒體插件中添加,它不會爲我構建。添加媒體插件後,Ionic Cordova IOS構建失敗

我甚至試圖創建一個新的啓動器選項卡項目,然後添加媒體插件如圖所示。由於添加了媒體插件,該項目無法編譯。

npm install -g cordova ionic gulp 
ionic start ionicTest tabs 
ionic platform add ios 
cordova plugin add org.apache.cordova.media 
ionic build ios 

然後我刪除媒體插件並沒有任何問題的項目編譯完美

cordova plugin rm org.apache.cordova.media 
ionic build ios 

以下是錯誤消息我收到,我使用的科爾多瓦4.1.2版

The following build commands failed: 
    CompileC build/ionicTest.build/Debug-iphonesimulator/ionicTest.build/Objects-normal/i386/CDVFile.o ionicTest/Plugins/org.apache.cordova.file/CDVFile.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler 
    CompileC build/ionicTest.build/Debug-iphonesimulator/ionicTest.build/Objects-normal/i386/CDVLocalFilesystem.o ionicTest/Plugins/org.apache.cordova.file/CDVLocalFilesystem.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler 
    CompileC build/ionicTest.build/Debug-iphonesimulator/ionicTest.build/Objects-normal/i386/CDVSound.o ionicTest/Plugins/org.apache.cordova.media/CDVSound.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler 
    CompileC build/ionicTest.build/Debug-iphonesimulator/ionicTest.build/Objects-normal/i386/CDVAssetLibraryFilesystem.o ionicTest/Plugins/org.apache.cordova.file/CDVAssetLibraryFilesystem.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler 
(4 failures) 
Error: /Users/steven/web/ionicTest/platforms/ios/cordova/build: Command failed with exit code 65 

回答

17

當你添加一個插件時,你必須刪除並添加平臺才能編譯它(這是一個bug)。請嘗試以下操作:

  1. 科爾多瓦插件添加org.apache.cordova.media
  2. 離子平臺刪除IOS
  3. 離子平臺添加IOS

另外,還要確保你站在應用目錄(ionicTest)發出命令時。檢查您的應用程序文件夾中是否有平臺插件(與www位於同一級別)。如果沒有,請在安裝插件之前創建它們。如果它們丟失,插件安裝將失敗,可能沒有錯誤信息。

+0

謝謝,真棒答案...它現在起作用。煩人的你需要刪除然後添加平臺,我很困惑,該平臺意味着IOS或Android :)但只是這2個命令很容易,我想平臺意味着Ionic或科爾多瓦......當然這是框架,易於修復。 – 2014-11-24 11:01:59

+0

只是一個注意,當這不是爲我工作,我意識到,你可以使用HTML5音頻相同的效果,並且它的工作以及...

+0

這也適用於我。謝謝! – colefner 2015-02-11 07:49:50