在尝试构建应用程序时,我在XCode中收到“Command /usr/bin/codesign failed”

CodeSign /Users/ompatel/Library/Developer/Xcode/DerivedData/MakeThemFall-ckljohmknnkuehgbzbfbwmcmrfpa/Build/Products/Debug-iphonesimulator/MakeThemFall.app
    cd "/Users/ompatel/Downloads/2 App First/MakeThemFall/MakeThemFall.spritebuilder"
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/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/ompatel/Library/Developer/Xcode/DerivedData/MakeThemFall-ckljohmknnkuehgbzbfbwmcmrfpa/Build/Products/Debug-iphonesimulator/MakeThemFall.app

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

最佳答案 您的一个或多个文件似乎包含任何其他扩展属性.从OSX Sierra开始通过安全加固弹出此错误.

请参阅Apple技术说明和解决方案:https://developer.apple.com/library/content/qa/qa1940/_index.html

This is a security hardening change that was introduced with iOS 10, macOS Sierra, watchOS 3, and tvOS 10.

Code signing no longer allows any file in an app bundle to have an extended attribute containing a resource fork or Finder info.

To see which files are causing this error, run this command in Terminal:

$xattr -lr path_to_app_bundle

replacing path_to_app_bundle with the path to your actual app bundle

You can also remove all extended attributes from your app bundle with the xattr command:

$xattr -cr path_to_app_bundle

Note that browsing files within a bundle with Finder’s Show Package Contents command can cause Finder info to be added to those files. Otherwise, audit your build process to see where the extended attributes are being added

在该命令之后执行产品>干净,然后再试一次.

注意:将项目保存在Dropbox中将始终添加扩展属性,但您可以在Dropbox设置中停用此行为

点赞