I met with a really weird problem when programming with iPhone app using xcode
Every other time, my build will fail with
"Command /usr/bin/codesign failed with exit code 1" as the error.
However, the second time it will succeed.
This is the details of the error
CodeSign "build/Release-iphoneos/x.app"
cd /Users/x/Documents/x/three20/x
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv _CODESIGN_ALLOCATE_ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
/usr/bin/codesign -f -s "iPhone Developer: x" "--resource-rules=/Users/x/Documents/x/three20/x/build/Release-iphoneos/x.app/ResourceRules.plist" --entitlements "/Users/x/Documents/x/three20/xx/build/template.build/Release-iphoneos/x.build/x.xcent" "/Users/x/Documents/x/three20/x/build/Release-iphoneos/x.app"
/Users/x/Documents/x/three20/x/build/Release-iphoneos/x.app: object file format invalid or unsuitable
Command /usr/bin/codesign failed with exit code 1
While the second time when it succeeds, it has the following warning:
"
Check dependencies
[WARN]Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Info.plist'.
"
"Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Info.plist'.
"
After hours' search, there are NO other good posts talking about this. Many people asked this question, but no good answer found.
I tried myself many different ways and finally, I know why!!
This is because Info.plist includes self as target.
Then how to fix????
Info.plist -> Get Info -> Targets -> If your app is checked, click that check mark to make it unchecked.
This simple uncheck fixes everything!