2016-09-12 42 views
44

我在macOS Sierra上遇到了严重的问题。 当我尝试构建我的应用程序时,出现以下问题。Xcode 8无法归档“command/usr/bin/codesign失败,退出代码1”

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 

然后我在终端做了https://forums.developer.apple.com/thread/48905,如下所示。但一旦我清理干净,问题就会回来。

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

ls [email protected] * 

xattr -c * 

并且此解决方案不适用于以下问题存档。有没有解决方案?

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 
+0

您是否找到了解决办法?大约两周前我下载了Xcode 8,并与它签署了相同的应用程序。几天前我已经安装了macOS Sierra(之前我曾经使用过El Capitan),现在它并没有签署相同的应用程序。 –

+0

同样在这里,这让我疯狂。只有当我有一个CocoaPods项目才会发生。 – noisedan

+1

@noisedan没有CocoaPods在这里,也有问题。我不认为它与豆荚有关。但似乎项目具体。例如,这发生在我的MacOS应用程序中,没有任何豆荚,但我有一个带有豆荚的iOS应用程序,它的签名完美。 –

回答

6

这得到由具有文件系统,可能是由塞拉利昂的MacOS造成了额外的属性一些资源文件引起的(因为我一开始升级到MacOS的塞拉利昂之后有它)。

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

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

删除只在build文件夹属性进行调试时,固定我的问题。整个删除属性DerivedData文件夹也修复了我的归档。请注意,它可能会导致其他后果(尽管极不可能),但您可以随时删除DerivedData文件夹,并且它会被重新生成,以防万一有任何破坏。

另外,如果仍然失败,执行该命令后清理该项目(而不是 build文件夹)是个不错的主意。

+0

感谢您解释 - 总是更好地理解正在发生的事情,而不是盲目复制粘贴终端命令。 –

108

我发现在苹果论坛上该解决方案

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

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

为我工作.. – Clement

+1

谁是谁发现这个天才?非常感谢! – Dmitry

+1

这也适用于我。你是一个救星!我花了几个小时。 – Jackson

12

工作对我来说这样的:

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

,然后重建

+0

在macOS Sierra上为我工作。谢谢! – pdesantis

+0

也为我工作(macOS Sierra)。谢谢.. –

+0

节电器给我。我尝试了一切。运行'xattr -c *'也没有帮助。 – Rajal

20

解决方案1:

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

在终端,转到项目的根目录,然后执行一个个命令

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

清洁Xcode和重新构建。完成。

解决方案2:

您可以通过寻找持有取景器信息文件解决这个问题。

在终端,转到项目根目录,并执行

ls [email protected] . > kundapura.txt 

这当前目录中创建kundapura.txt。现在搜索com.apple.FinderInfo并清除所有文件的这些属性。你可以这样做

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

一旦你清除所有,那么你可以编码的迹象。干杯

+1

解决方案1 ​​ - 为我工作。谢谢! –

+1

第一个解决方案在macOS Sierra上为我工作。这是**。png **文件的问题。非常感谢! – JonyMateos

+0

解决方案1也适用于我。此列表中没有其他内容 –

3

我有这个问题,从CocoaPods包中的一个文件。 我已经更新的CocoaPods到最新版本,并运行:

pod install 

,这个问题已经消失。

+1

这样做然后运行Cmd + shift + k(即清理)在我的项目在Xcode为我工作 –

9

有一个更永久的解决方案。修复DerivedData中的属性的作用,但问题不断回来。当你得到'资源分叉,Finder信息或不允许的类似碎片'时,你需要做的是进入显示的目录,该目录包含.App文件。然后执行...

XATTR -lr MyAppName.App

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

xattr -rc。

然后修复原始文件。然后重建应该运行正常。它也应该也适用于档案重建。

+0

这是唯一建议在这里工作对我来说!谢谢! – rozmichelle

+1

为我工作。罪魁祸首文件在Images.xcassets文件夹中的图标文件的位置。 –

+0

当我运行'xattr -lr MyAppName.app'时,什么都没有列出 – arnoldbird

0

在我的情况下,

转到

  • Xcode的偏好

  • 位置

  • 点击项目路径箭头

  • 在DerivedData文件夹中搜索自己项目AME

  • 选择项目文件夹,右击并移至回收站

完成!

0

我在macOS Sierra 10.12.3,Xcode 8.2上遇到了这个错误。 修复DerivedData不适用于我。

之后我删除过期苹果全球开发者关系的证书颁发机构证书钥匙串访问错误就走开了。

2
在我的情况的问题

与部署配置文件和帐户,我固定通过执行下列步骤操作:

  1. Xcode的首选项 - > Accounts->删除已添加的帐户,再
  2. 添加它生成新的部署配置文件并安装在Xcode
  3. 清洁工程,甚至重建它
+1

我有这个相同的问题。当我在帐户中看到时,它告诉我会话过期登录再次。 –

0

有时候,如果你固定的和/或有正确的代码签名完成,日e问题可能潜伏在第三方软件包中。

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

在这种情况下,您必须重新构建您的第三方库。例如在我的情况下,通过carthage update进行更新,现在构建成功。

2

我想告诉我的答案,因为它可能有兴趣(我也浪费了大量的时间与这个错误)前面的答案(具有高得分)的

Error screenshot

都没有对我有用。

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

来源:

我添加了一个新的目标,以我的iPhone应用程序:iMessage的

当我将PNG图像的资产。 xcassets,发生错误。

解决方案:

请与“苹果Preview应用” PNG图像的副本,并取消阿尔法。

Preview App screenshot

错误信息消失。

Preview App screenshot

+0

这真的很有帮助。解决了我的问题:)快乐的编码。 – PJR

相关问题