Xcode 11 Swift: Command CodeSign failed with a nonzero exit code

jianghai 2019-09-04

ERROR
CodeSign /Users/XXX/Library/Developer/Xcode/DerivedData/XXX-euxtniuyxqtiroepntbfmgeupxfs/Build/Products/Debug-iphonesimulator/XXX.app (in target 'XXX' from project 'XXX')
cd /Users/XXX/Documents/workspace/xcode.proj/XXX
export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity: "-"

/usr/bin/codesign --force --sign - --entitlements /Users/XXX/Library/Developer/Xcode/DerivedData/XXX-euxtniuyxqtiroepntbfmgeupxfs/Build/Intermediates.noindex/XXX.build/Debug-iphonesimulator/XXX.build/XXX.app.xcent --timestamp=none /Users/XXX/Library/Developer/Xcode/DerivedData/XXX-euxtniuyxqtiroepntbfmgeupxfs/Build/Products/Debug-iphonesimulator/XXX.app

/Users/XXX/Library/Developer/Xcode/DerivedData/VipCare-euxtniuyxqtiroepntbfmgeupxfs/Build/Products/Debug-iphonesimulator/XXX.app: bundle format unrecognized, invalid, or unsuitable
In subcomponent: /Users/XXX/Library/Developer/Xcode/DerivedData/XXX-euxtniuyxqtiroepntbfmgeupxfs/Build/Products/Debug-iphonesimulator/XXX.app/Base.lproj
Command CodeSign failed with a nonzero exit code

including a folder named "resources" in the project causes this error. After renaming my "resources" folder, the error went away.

What I found was that having a folder named "resources" in the application bundle will cause code sign to fail. This seems to be an undocumented consequence of some implementation detail of iOS apps or code signing, I think. An empty project with just a resources folder with one random file in it reproduced the issue.

I couldn't easily rename the folder with our shared codebase so my solution was to put my "resources" folder in a parent folder with a different name, and adjust the way our resource path was built.

1. Find "resource" folder in your project. and rename it

2. Product -> Clean Build Folder

3. Product -> Build

相关推荐

APCDE / 0评论 2019-12-01
野生的世界 / 0评论 2015-10-29