xcode iphone构建错误让我想买一把钉枪

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3020113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:26:56  来源:igfitidea点击:

iphone build error that makes me want to buy a nail gun

iphonexcodebuild

提问by sol

I'm just trying to build a simple update (which I have done before) for an iphone app, but now for some reason I'm getting this error. Can anyone tell me what it means?

我只是想为一个 iphone 应用程序构建一个简单的更新(我以前做过),但现在由于某种原因我收到了这个错误。谁能告诉我这是什么意思?

Command/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist failed with exit code 127
sh: plutil: command not found

Here are the Build Results:

以下是构建结果:

CopyPNGFile /Users/me/path/build/Dist-iphoneos/MyApp.app/img_000.png images/img_000.png
    cd /Users/me/
    setenv COPY_COMMAND /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Frameworks/JavaVM.frameworK/Versions/1.6/Home/"
    "/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS Build System Support.xcplugin/Contents/Resources/copypng" -compress "" /Users/path/images/img_000.png /Users/me/path/build/Dist-iphoneos/MyApp.app/img_000.png
sh: dirname: command not found

CopyPlistFile /Users/me/path/build/Dist-iphoneos/MyApp.app/Entitlements.plist Entitlements.plist
    cd /Users/me/
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Frameworks/JavaVM.frameworK/Versions/1.6/Home/"
    /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist --convert binary1 Entitlements.plist --outdir /Users/me/path/build/Dist-iphoneos/MyApp.app
sh: plutil: command not found

回答by Kalle

Your PATH variable is screwed up for some reason. You want to look into how exactly that happened. This is yours (colon-separated for emphasis):

由于某种原因,您的 PATH 变量被搞砸了。你想看看这到底是怎么发生的。这是你的(冒号分隔以强调):

setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
    :/Developer/usr/bin
    :/System/Library/Frameworks/JavaVM.frameworK/Versions/1.6/Home/"

This is what a working PATH looks like:

这是一个工作路径的样子:

setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
    :/Developer/usr/bin
    :/usr/bin
    :/bin
    :/usr/sbin
    :/sbin"

(line separation is to clarify how PATH variables are separating paths)

(行分隔是为了阐明PATH变量是如何分隔路径的)

Notice how mine has /usr/bin:/bin:/usr/sbin:/sbin and yours does not? This is the problem right there. The shell script only finds executables in its path, and while the files are in /usr/bin/, it doesn't find them.

请注意我的 /usr/bin:/bin:/usr/sbin:/sbin 而你的没有?这就是问题所在。shell 脚本只在其路径中找到可执行文件,而文件在 /usr/bin/ 中时,它没有找到它们。

For an SO discussion on Xcode PATH's, see e.g. where is $PATH set in xcode?

有关 Xcode PATH 的 SO 讨论,请参阅例如$PATH 在 xcode 中设置的位置?

回答by keith

I had same problem.... the problem is that plutil is not in any of the directories in PATH.

我有同样的问题.... 问题是 plutil 不在 PATH 中的任何目录中。

My solution was to make a copy from /usr/bin to /user/local/bin which is in the PATH.

我的解决方案是从 /usr/bin 复制到 PATH 中的 /user/local/bin。

No idea if the problem is Xcode, OS X or Apple.

不知道问题出在 Xcode、OS X 还是 Apple。

回答by Dad

Is it possible that your path environment variable is not set somehow?

是否有可能您的路径环境变量未以某种方式设置?

You have:

你有:

setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Frameworks/JavaVM.frameworK/Versions/1.6/Home/" /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist --convert binary1 Entitlements.plist --outdir /Users/me/path/build/Dist-iphoneos/MyApp.app

setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Frameworks/JavaVM.frameworK/Versions/1.6/Home/" /Developer/Library/Xcode/插件/CoreBuildTasks.xcplugin/Contents/Resources/copyplist --convert binary1 Entitlements.plist --outdir /Users/me/path/build/Dist-iphoneos/MyApp.app

While I show:

当我展示:

setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/opt/local/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin" builtin-infoPlistUtility test34-Info.plist -genpkginfo /Users/gnd/Desktop/test34/build/Debug-iphonesimulator/test34.app/PkgInfo -expandbuildsettings -format binary -platform iphonesimulator -o /Users/gnd/Desktop/test34/build/Debug-iphonesimulator/test34.app/Info.plist

setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/opt/local/bin:/usr/local/bin:/bin:/sbin:/usr/bin: /usr/sbin" builtin-infoPlistUtility test34-Info.plist -genpkginfo /Users/gnd/Desktop/test34/build/Debug-iphonesimulator/test34.app/PkgInfo -expandbuildsettings -format binary -platform iphonesimulator -o /Users/gnd/桌面/test34/build/Debug-iphonesimulator/test34.app/Info.plist

I don't see /usr/bin in your path.

我在您的路径中没有看到 /usr/bin。

(in terminal:
echo ${PATH}

(在终端:
echo ${PATH}

though most OS X GUI applications get their path from ~/.MacOSX/environment.plist not 100% sure about Xcode though.

尽管大多数 OS X GUI 应用程序从 ~/.MacOSX/environment.plist 获取路径,但对 Xcode 不是 100% 确定。



附加信息:

from the 'man bash' page:

从'man bash'页面:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

当 bash 作为交互式登录 shell 或作为带有 --login 选项的非交互式 shell 调用时,它首先从文件 /etc/profile 读取并执行命令(如果该文件存在)。读取该文件后,它会按顺序查找 ~/.bash_profile、~/.bash_login 和 ~/.profile,然后从第一个存在且可读的命令中读取和执行命令。

So if you have it in .bash_login but .bash_profile exists, then your change will not be seen.

因此,如果您在 .bash_login 中有它但 .bash_profile 存在,那么您的更改将不会被看到。

Also note the comment about the GUI apps PATH definition alternate file above.

还要注意上面关于 GUI 应用程序路径定义备用文件的注释。

You may need to log out and then back in to get the change to "take".

您可能需要注销然后重新登录才能将更改更改为“接受”。

回答by cdespinosa

plutilusually resides in /usr/bin. Make sure it's there. If it's not, you may have installed your Developer Tools without unchecking (or with unchecking) the System Tools checkbox, which puts the base Mac OS X programmer tools into /usr.

plutil通常驻留在/usr/bin. 确保它在那里。如果不是,您可能在没有取消(或取消选中)系统工具复选框的情况下安装了开发人员工具,该复选框将基本的 Mac OS X 程序员工具放入 /usr。

回答by tc.

Tried reinstalling the SDK?

尝试重新安装 SDK?

回答by Dov

I have gone over the answers provided and none of them worked for me. The problem persisted.

我已经检查了提供的答案,但没有一个对我有用。问题仍然存在。

I looked carefully at the error in xcode and notice that it was looking for the image in the wrong place. In my case I had copied and renamed the directory containing my project. None of the references to my images were updated.

我仔细查看了 xcode 中的错误,并注意到它在错误的位置寻找图像。就我而言,我复制并重命名了包含我的项目的目录。没有更新对我的图像的引用。

I fixed my problem by right clicking the project file in finder and clicking Show Package Contents. I then opened the *.pbxproj in xcode. I did a find and replace on the file to replace the name of the old folder with the new folder.

我通过右键单击 finder 中的项目文件并单击“显示包内容”解决了我的问题。然后我在 xcode 中打开了 *.pbxproj。我对文件进行了查找和替换,以将旧文件夹的名称替换为新文件夹。

After closing and opening xcode this solved my problem.

关闭并打开 xcode 后,这解决了我的问题。

I hope this helps others...

我希望这可以帮助其他人...

回答by owen gerig

this error will also show if you deleted a file via finder (not in xcode) then try to archive. So make sure that none of your files are listed in red and if they are remove it from your project.

如果您通过查找程序(不是在 xcode 中)删除文件然后尝试存档,此错误也会显示。因此,请确保您的所有文件都没有以红色列出,并且是否将其从您的项目中删除。

回答by Bill Burgess

I've seen this error before. The issue lies in a corrupted .png file. The error is pretty deceiving. Try deleting the affected .png and replace it back in your project from a backup or clean version of that file. That should clear up the build errors.

我以前见过这个错误。问题在于损坏的 .png 文件。这个错误很有欺骗性。尝试删除受影响的 .png 并将其从该文件的备份或干净版本中替换回您的项目中。那应该清除构建错误。