Xcode 8无法存档“命令/usr/bin/codesign退出码1失败”

时间:2023-01-18 16:43:06

I've got a serious problem on Xcode 8 on macOS Sierra. when I try to build my app, I get the following issue.

我在macOS Sierra的Xcode 8上遇到了一个严重的问题。当我尝试构建我的应用程序时,我得到了如下的问题。

CodeSign /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app
cd /Users/me/Desktop/MyAppFolder1/MyAppFolder2/MyAppxcode
export CODESIGN_ALLOCATE=/Users/me/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Users/me/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Users/me/Downloads/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "-"

/usr/bin/codesign --force --sign - --timestamp=none /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app

/Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1

then I did https://forums.developer.apple.com/thread/48905 in the terminal as the following and it worked. but once I clean, the issue comes back.

然后我在终端中做了https://forums.developer.apple.com/thread/48905,它就这样运行了。但一旦我清理干净,问题又回来了。

cd /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Products/Debug-iphonesimulator/MyApp

ls -al@ *

xattr -c *

and this solution doesn't work for archive with the following issue. is there any solution for it?

而这个解决方案对于以下问题的存档不起作用。有什么解决办法吗?

CodeSign /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
cd /Users/me/Desktop/MyAppFolder1/MyAppFolder2/MyAppxcode
export CODESIGN_ALLOCATE=/Users/me/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Users/me/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Users/me/Downloads/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "iPhone Developer: My Name (**********)"
Provisioning Profile: "iOS Team Provisioning Profile: com.**********.*********"
                  (********-****-****-****-************)

/usr/bin/codesign --force --sign **************************************** --entitlements /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.app.xcent --timestamp=none /Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app

/Users/me/Library/Developer/Xcode/DerivedData/MyApp-gnoiiwnelmxzdidnijaswisrwdqe/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1

11 个解决方案

#1


108  

I found this solution in the Apple forum

我在苹果论坛上找到了这个解决方案

cd ~/Library/Developer/Xcode/DerivedData
xattr -rc .

or

xattr -rc ~/Library/Developer/Xcode/DerivedData

#2


21  

Solution 1:

解决方案1:

You can try file specific bash command like Mark McCorkle answered.

您可以尝试文件特定的bash命令,如Mark McCorkle应答。

In terminal, goto project's root directory and execute one by one command

在终端中,goto项目的根目录并逐个执行命令

  find . -type f -name '*.jpeg' -exec xattr -c {} \;
  find . -type f -name '*.png' -exec xattr -c {} \;
  find . -type f -name '*.tif' -exec xattr -c {} \;

Clean Xcode and Re Build. Done.

清除Xcode并重新构建。完成了。

Solution 2:

解决方案2:

You can fix this problem by finding files which holds finder information.

您可以通过查找保存查找程序信息的文件来解决这个问题。

In terminal, goto project root directory and execute

在终端,去项目根目录和执行

ls -alR@ . > kundapura.txt

This creates kundapura.txt in current directory. Now search for com.apple.FinderInfo and clear this attributes for all files. You can do it like this

这将创建kundapura。txt在当前目录。现在寻找com.apple。FinderInfo并为所有文件清除此属性。你可以这样做

xattr -c <filename>
Example: xattr -c guru.png

Once you clear all then you are able to code sign. Cheers

一旦您清除了所有,那么您就可以进行代码签名。干杯

#3


12  

For me worked this:

对我来说工作:

cd ~/Library/Developer/Xcode/DerivedData
xattr -dr com.apple.FinderInfo *

And then rebuild

然后重建

#4


9  

There is a more permanent fix for this. Fixing the attributes in the DerivedData works, but the problem keeps coming back. What you need to do is go to the directory shown when you get the 'resource fork, Finder information, or similar detritus not allowed', the one that contains the .App file. Then execute...

有一个更持久的解决方法。修复派生数据中的属性是有效的,但是问题还在继续。你需要做的是进入“资源叉、查找器信息或不允许的类似碎屑”(包含. app文件)时显示的目录。然后执行…

xattr -lr MyAppName.App

xattr lr MyAppName.App

You can then see the resource files that have the attributes that need removing. Don't remove them from the .App file though, find the original files in your project and open the directory that contains them and execute...

然后您可以看到具有需要删除的属性的资源文件。不要从.App文件中删除它们,找到项目中的原始文件并打开包含它们的目录并执行…

xattr -rc .

xattr rc。

This then fixes the ORIGINAL files. Rebuild should then function ok. It should also then rebuild properly for archive too.

然后修复原始文件。然后重建应该正常工作。然后,它也应该适当地重建存档。

#5


6  

This gets caused by some resource files having extra attributes on the file system, probably caused by macOS Sierra (as I started having it after upgrading to macOS Sierra).

这是由文件系统中具有额外属性的一些资源文件引起的,可能是由macOS Sierra引起的(我在升级到macOS Sierra之后开始使用它)。

Try executing xattr -c * on the whole DerivedData folder (as stated by the answer in https://forums.developer.apple.com/message/178039#178039):

尝试在整个DerivedData文件夹上执行xattr -c *(如https://forums.developer.apple.com/message/178039#178039):

cd ~/Library/Developer/Xcode/DerivedData
xattr -c *

Removing attributes only on the build folder fixed the issue for me when debugging. Removing attributes on the whole DerivedData folder fixed it for me in archiving too. Please note that it may cause other consequences (albeit highly unlikely), but you can always delete the DerivedData folder and it will be regenerated, in case anything gets broken.

只删除build文件夹上的属性修复了调试时的问题。在整个DerivedData文件夹上删除属性也在归档中为我修复了它。请注意,它可能会导致其他后果(尽管非常不可能),但您总是可以删除DerivedData文件夹,并重新生成它,以防出现任何问题。

Also, if it still fails, cleaning the project (not the build folder) after executing the command is a good idea.

此外,如果它仍然失败,那么在执行命令之后清理项目(而不是构建文件夹)是一个好主意。

#6


4  

I had this problem with one file from CocoaPods bundle. I've updated CocoaPods to the latest version and run:

我有一个来自CocoaPods bundle的文件存在这个问题。我把可可豆更新到最新版本,然后运行:

pod install

after that, the problem has gone away.

在那之后,问题就消失了。

#7


2  

in my case issue was with Provisioning Profiles and Account, i fixed by doing these steps:

在我的案例中,关于配置文件和账户的问题,我通过以下步骤进行了修正:

  1. Xcode Preferences ->Accounts->Delete already added account and add it again
  2. Xcode首选项->帐户->删除已添加帐户并再次添加。
  3. Generate new Provisioning Profiles and installed in Xcode
  4. 生成新的配置文件并在Xcode中安装
  5. clean project and rebuild it
  6. 清理项目并重建

#8


2  

I want to show my answer because it may be of interest (I have wasted a lot of time with this error)

我想展示我的答案,因为它可能是有趣的(我在这个错误上浪费了很多时间)

Xcode 8无法存档“命令/usr/bin/codesign退出码1失败”

None of the previous answers (which have a high score) have been useful to me.

以前的答案(分数很高)对我都没有用处。

They may be correct, but they haven't solved my problem.

他们可能是对的,但是他们还没有解决我的问题。

Origin:

产地:

I added a new Target to my iOS application: iMessage

我在iOS应用程序中添加了一个新目标:iMessage

When I added png images to the Assets. xcassets, the error occurred.

当我将png图像添加到资产时。xcassets,错误发生。

Solution:

解决方案:

Make a copy of png images with "Apple Preview App" and uncheck Alpha.

用“Apple Preview App”和“uncheck Alpha”复制一份png图片。

Xcode 8无法存档“命令/usr/bin/codesign退出码1失败”

Error message disappears.

错误消息消失了。

Xcode 8无法存档“命令/usr/bin/codesign退出码1失败”

#9


0  

In my case,

在我的例子中,

Go to

  • Xcode preference

    Xcode的偏好

  • Locations

    位置

  • Click on Project Path arrow

    单击项目路径箭头

  • In DerivedData folder search for your project name

    在DerivedData文件夹中搜索您的项目名称。

  • Select project folder, Right click and Move to trash

    选择项目文件夹,右键单击并移动到垃圾箱

Done!

完成了!

#10


0  

I encountered this error on macOS Sierra 10.12.3, Xcode 8.2. Fixing the DerivedData did not work for me.

我在macOS Sierra 10.12.3 Xcode 8.2中遇到了这个错误。修复派生数据对我不起作用。

After I deleted an expired Apple Worldwide Developer Relations Certificate Authority certificate in Keychain Access the error went away.

在我删除了一个过期的苹果全球开发者关系证书认证证书在密钥链访问的错误消失了。

#11


0  

Sometimes even if you fixed and/or had correct code-signing done, the problem might lurk in 3rd-party packages.

有时,即使您修复和/或完成了正确的代码签名,问题也可能潜伏在第三方包中。

If you closely check out your build error, you might find the name of the 3rd-party libraries on the error message.

如果您仔细检查构建错误,您可能会在错误消息上找到第三方库的名称。

In this case, you must build your 3rd-party libraries again. For example in my case, update it via carthage update and now the build succeeded properly.

在这种情况下,您必须再次构建您的第三方库。例如,在我的例子中,通过carthage更新更新它,现在构建成功了。

#1


108  

I found this solution in the Apple forum

我在苹果论坛上找到了这个解决方案

cd ~/Library/Developer/Xcode/DerivedData
xattr -rc .

or

xattr -rc ~/Library/Developer/Xcode/DerivedData

#2


21  

Solution 1:

解决方案1:

You can try file specific bash command like Mark McCorkle answered.

您可以尝试文件特定的bash命令,如Mark McCorkle应答。

In terminal, goto project's root directory and execute one by one command

在终端中,goto项目的根目录并逐个执行命令

  find . -type f -name '*.jpeg' -exec xattr -c {} \;
  find . -type f -name '*.png' -exec xattr -c {} \;
  find . -type f -name '*.tif' -exec xattr -c {} \;

Clean Xcode and Re Build. Done.

清除Xcode并重新构建。完成了。

Solution 2:

解决方案2:

You can fix this problem by finding files which holds finder information.

您可以通过查找保存查找程序信息的文件来解决这个问题。

In terminal, goto project root directory and execute

在终端,去项目根目录和执行

ls -alR@ . > kundapura.txt

This creates kundapura.txt in current directory. Now search for com.apple.FinderInfo and clear this attributes for all files. You can do it like this

这将创建kundapura。txt在当前目录。现在寻找com.apple。FinderInfo并为所有文件清除此属性。你可以这样做

xattr -c <filename>
Example: xattr -c guru.png

Once you clear all then you are able to code sign. Cheers

一旦您清除了所有,那么您就可以进行代码签名。干杯

#3


12  

For me worked this:

对我来说工作:

cd ~/Library/Developer/Xcode/DerivedData
xattr -dr com.apple.FinderInfo *

And then rebuild

然后重建

#4


9  

There is a more permanent fix for this. Fixing the attributes in the DerivedData works, but the problem keeps coming back. What you need to do is go to the directory shown when you get the 'resource fork, Finder information, or similar detritus not allowed', the one that contains the .App file. Then execute...

有一个更持久的解决方法。修复派生数据中的属性是有效的,但是问题还在继续。你需要做的是进入“资源叉、查找器信息或不允许的类似碎屑”(包含. app文件)时显示的目录。然后执行…

xattr -lr MyAppName.App

xattr lr MyAppName.App

You can then see the resource files that have the attributes that need removing. Don't remove them from the .App file though, find the original files in your project and open the directory that contains them and execute...

然后您可以看到具有需要删除的属性的资源文件。不要从.App文件中删除它们,找到项目中的原始文件并打开包含它们的目录并执行…

xattr -rc .

xattr rc。

This then fixes the ORIGINAL files. Rebuild should then function ok. It should also then rebuild properly for archive too.

然后修复原始文件。然后重建应该正常工作。然后,它也应该适当地重建存档。

#5


6  

This gets caused by some resource files having extra attributes on the file system, probably caused by macOS Sierra (as I started having it after upgrading to macOS Sierra).

这是由文件系统中具有额外属性的一些资源文件引起的,可能是由macOS Sierra引起的(我在升级到macOS Sierra之后开始使用它)。

Try executing xattr -c * on the whole DerivedData folder (as stated by the answer in https://forums.developer.apple.com/message/178039#178039):

尝试在整个DerivedData文件夹上执行xattr -c *(如https://forums.developer.apple.com/message/178039#178039):

cd ~/Library/Developer/Xcode/DerivedData
xattr -c *

Removing attributes only on the build folder fixed the issue for me when debugging. Removing attributes on the whole DerivedData folder fixed it for me in archiving too. Please note that it may cause other consequences (albeit highly unlikely), but you can always delete the DerivedData folder and it will be regenerated, in case anything gets broken.

只删除build文件夹上的属性修复了调试时的问题。在整个DerivedData文件夹上删除属性也在归档中为我修复了它。请注意,它可能会导致其他后果(尽管非常不可能),但您总是可以删除DerivedData文件夹,并重新生成它,以防出现任何问题。

Also, if it still fails, cleaning the project (not the build folder) after executing the command is a good idea.

此外,如果它仍然失败,那么在执行命令之后清理项目(而不是构建文件夹)是一个好主意。

#6


4  

I had this problem with one file from CocoaPods bundle. I've updated CocoaPods to the latest version and run:

我有一个来自CocoaPods bundle的文件存在这个问题。我把可可豆更新到最新版本,然后运行:

pod install

after that, the problem has gone away.

在那之后,问题就消失了。

#7


2  

in my case issue was with Provisioning Profiles and Account, i fixed by doing these steps:

在我的案例中,关于配置文件和账户的问题,我通过以下步骤进行了修正:

  1. Xcode Preferences ->Accounts->Delete already added account and add it again
  2. Xcode首选项->帐户->删除已添加帐户并再次添加。
  3. Generate new Provisioning Profiles and installed in Xcode
  4. 生成新的配置文件并在Xcode中安装
  5. clean project and rebuild it
  6. 清理项目并重建

#8


2  

I want to show my answer because it may be of interest (I have wasted a lot of time with this error)

我想展示我的答案,因为它可能是有趣的(我在这个错误上浪费了很多时间)

Xcode 8无法存档“命令/usr/bin/codesign退出码1失败”

None of the previous answers (which have a high score) have been useful to me.

以前的答案(分数很高)对我都没有用处。

They may be correct, but they haven't solved my problem.

他们可能是对的,但是他们还没有解决我的问题。

Origin:

产地:

I added a new Target to my iOS application: iMessage

我在iOS应用程序中添加了一个新目标:iMessage

When I added png images to the Assets. xcassets, the error occurred.

当我将png图像添加到资产时。xcassets,错误发生。

Solution:

解决方案:

Make a copy of png images with "Apple Preview App" and uncheck Alpha.

用“Apple Preview App”和“uncheck Alpha”复制一份png图片。

Xcode 8无法存档“命令/usr/bin/codesign退出码1失败”

Error message disappears.

错误消息消失了。

Xcode 8无法存档“命令/usr/bin/codesign退出码1失败”

#9


0  

In my case,

在我的例子中,

Go to

  • Xcode preference

    Xcode的偏好

  • Locations

    位置

  • Click on Project Path arrow

    单击项目路径箭头

  • In DerivedData folder search for your project name

    在DerivedData文件夹中搜索您的项目名称。

  • Select project folder, Right click and Move to trash

    选择项目文件夹,右键单击并移动到垃圾箱

Done!

完成了!

#10


0  

I encountered this error on macOS Sierra 10.12.3, Xcode 8.2. Fixing the DerivedData did not work for me.

我在macOS Sierra 10.12.3 Xcode 8.2中遇到了这个错误。修复派生数据对我不起作用。

After I deleted an expired Apple Worldwide Developer Relations Certificate Authority certificate in Keychain Access the error went away.

在我删除了一个过期的苹果全球开发者关系证书认证证书在密钥链访问的错误消失了。

#11


0  

Sometimes even if you fixed and/or had correct code-signing done, the problem might lurk in 3rd-party packages.

有时,即使您修复和/或完成了正确的代码签名,问题也可能潜伏在第三方包中。

If you closely check out your build error, you might find the name of the 3rd-party libraries on the error message.

如果您仔细检查构建错误,您可能会在错误消息上找到第三方库的名称。

In this case, you must build your 3rd-party libraries again. For example in my case, update it via carthage update and now the build succeeded properly.

在这种情况下,您必须再次构建您的第三方库。例如,在我的例子中,通过carthage更新更新它,现在构建成功了。