8
rm -rf plugins/*
rm -rf platforms/*

phonegap build ios //this works

phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

phonegap build ios

Building for ios after adding a plugin fails. Here is the error:

** BUILD FAILED **


The following build commands failed:
    CompileC build/PondMD.build/Debug-iphoneos/PondMD.build/Objects-normal/armv7/CDVDevice.o PondMD/Plugins/org.apache.cordova.device/CDVDevice.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
2014-01-16 10:32:15.055 xcodebuild[69605:1007] [MT] PluginLoading: Required plug-in compatibility UUID 37B30044-3B14-46BA-ABAA-F01000C27B63 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XCode4_beginning_of_line.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-01-16 10:32:16.630 xcodebuild[69605:4203]  DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details:  Failed to load dependencies output contents from ``/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “CDVDevice.d” couldn’t be opened because there is no such file." UserInfo=0x7fe7a57a7440 {NSFilePath=/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d, NSUnderlyingError=0x7fe7a57aaed0 "The operation couldn’t be completed. No such file or directory"}. User info: {
    NSFilePath = "/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d";
    NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread:   <NSThread: 0x7fe7a57ab420>{name = (null), num = 7}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

The issue seems to be that phonegap is not copying the objective-c classes and headers into /platforms/ios/

william-macbook-pro:PhonegapPondMD william$ ls -l plugins/
total 8
-rw-r--r--   1 william  staff  296 Jan 16 10:32 ios.json
drwxr-xr-x  11 william  staff  374 Jan 16 10:30 org.apache.cordova.device

william-macbook-pro:PhonegapPondMD william$ ls -l platforms/ios/PondMD/Plugins/
total 8
-rw-r--r--  1 william  staff  890 Jan 16 10:30 README

william-macbook-pro:PhonegapPondMD william$ phonegap -v
3.3.0-0.18.0
2
  • try to remove the plugin properly : "phonegap local plugin remove com.plugin.pluginid" and reinstall. I'm not sure that removing plugins and platforms cleans everything. Or try with a clean project.
    – QuickFix
    Jan 16, 2014 at 16:57
  • @QuickFix. Just tried: "william-macbook-pro:PhonegapPondMD william$ phonegap local plugin remove org.apache.cordova.device; phonegap local plugin add org.apache.cordova.device; phonegap build ios;". Still get the build error.
    – WSkinner
    Jan 16, 2014 at 17:11

4 Answers 4

21

I had the same problem, and I solved It creating the project with uppercase in the first letter of project name. Yes, it seems incredible, but this was the solution.

5
  • 9
    This is the most ridiculous answer I've ever had to upvote! This is definitely something that should be in the docs. Jan 23, 2014 at 3:29
  • 1
    Another important detail: I think Cordova/Phonegap also has problems if the name of the project (and thus the name of the generated folder) has white spaces, at least in iOS.
    – salgiza
    Feb 28, 2014 at 13:08
  • 3
    this should be considered a bug to Phonegap
    – Nathan Do
    Mar 11, 2014 at 4:27
  • 2
    A serious bug! Thanks @Carra
    – vrunoa
    Mar 11, 2014 at 14:43
  • 3
    this is still an issue in Late November 2014
    – Subtubes
    Nov 26, 2014 at 0:46
13

I ran into the same issue and solved it by using the instructions here: Cordova 3.2 ios add plugin "Which config.xml? Where is it?"

To summarize, I did the following steps:
1. Removed ios platform via: cordova platform remove ios
2. Re-installed the plugin
3. (Re-)Added the ios platform via: cordova platform add ios
4. Built the project again

After this, it built just fine.

2
  • 3
    Even more strange, it seems that all you need to do after adding any number of plugins, is remove and re-add your platforms. cordova platform rm android ios && cordova platform add android ios && cordova build works for me everytime I add a new plugin.
    – jhoff
    Jul 23, 2014 at 1:52
  • removing and re-adding ios platform results in lost of all the implementation done in the xcode project. Sep 2, 2015 at 16:33
0

When I added the plugin using cordova plugin add command, it puts the plugin code inside a plugins folder. When you inspect the plugin folder inside the ios platform, you would see the plugin is not available.

So I created a folder with the same name as the plugin name and copied the files from the plugin src/ directory into this. After this the project built correctly.

I also found it useful to open the native project in xcode to inspect the project closer.

0

I went with the solution to copy the plugin files from ./plugins/.. to the ios platform plugin directory. Whoever needs it, here is a little helper for gulp.

(npm install gulp gulp-rename)

(gulpfile.js)

var gulp = require("gulp");
var rename = require("gulp-rename");
gulp.task("cp-plugins-ios", function(){
   gulp.src(["./plugins/*/src/ios/*"],{base: 'ios'}).pipe(rename(function(path){
      var myDir = path.dirname.replace("src/ios","");
      path.dirname = myDir;
   })).pipe(gulp.dest("./platforms/ios/projectName/Plugins/"));
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.