【问题标题】:Phonegap doesn't copy plugin files to ios platforms directory during buildPhonegap 在构建期间不会将插件文件复制到 ios 平台目录
【发布时间】:2016-09-20 21:41:43
【问题描述】:
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

添加插件后为 ios 构建失败。这是错误:

** 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.

问题似乎是 phonegap 没有将 Objective-c 类和标头复制到 /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

【问题讨论】:

  • 尝试正确删除插件:“phonegap local plugin remove com.plugin.pluginid”并重新安装。我不确定删除插件和平台是否会清除所有内容。或者尝试一个干净的项目。
  • @QuickFix。刚试过:“william-macbook-pro:PhonegapPondMD william$ phonegap local plugin remove org.apache.cordova.device; phonegap local plugin add org.apache.cordova.device; phonegap build ios;”。仍然得到构建错误。

标签: ios cordova


【解决方案1】:

我遇到了同样的问题,我解决了它在项目名称的第一个字母中使用大写创建项目。是的,这似乎令人难以置信,但这就是解决方案。

【讨论】:

  • 这是我不得不投票的最荒谬的答案!这绝对是文档中应该包含的内容。
  • 另一个重要细节:我认为如果项目的名称(以及生成的文件夹的名称)有空格,Cordova/Phonegap 也会有问题,至少在 iOS 中是这样。
  • 这应该被认为是Phonegap的一个错误
  • 一个严重的错误!谢谢@Carra
  • 这在 2014 年 11 月下旬仍然是一个问题
【解决方案2】:

我遇到了同样的问题,并使用此处的说明解决了它:Cordova 3.2 ios add plugin "Which config.xml? Where is it?"

总而言之,我做了以下步骤:
1. 移除 ios 平台方式:cordova platform remove ios
2.重新安装插件
3.(重新)通过:cordova platform add ios
添加了ios平台 4.再次构建项目

在此之后,它构建得很好。

【讨论】:

  • 更奇怪的是,添加任意数量的插件后,您似乎需要做的就是删除并重新添加您的平台。每次我添加新插件时,cordova platform rm android ios &amp;&amp; cordova platform add android ios &amp;&amp; cordova build 都会为我工作。
  • 移除和重新添加 ios 平台会导致在 xcode 项目中完成的所有实现丢失。
【解决方案3】:

当我使用cordova plugin add 命令添加插件时,它会将插件代码放在 plugins 文件夹中。 当您在 ios 平台中检查插件文件夹时,您会发现该插件不可用。

所以我创建了一个与插件名称相同的文件夹,并将插件 src/ 目录中的文件复制到此文件夹中。在此之后,项目正确构建。

我还发现在 xcode 中打开本机项目以更仔细地检查项目很有用。

【讨论】:

    【解决方案4】:

    我采用了将插件文件从 ./plugins/.. 复制到 ios 平台插件目录的解决方案。谁需要,这里有一个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/"));
    });
    

    【讨论】:

      猜你喜欢
      • 2013-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多