Tuesday, January 18, 2011

iPhone Xcode codesign problem

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!




7 comments:

Anonymous said...

thank you very much for this post! i was already very close to just accept the fact of building everything twice...

Anonymous said...

You are awesome for posting this, thank you, just save me from debugging for hours. :)

Cheers

Anonymous said...

Yesss! It works. Thanks for the solution

Anonymous said...

You are the greatest! This also fixes my "hangs on attaching to " problem.

Anonymous said...

Don't see any 'Target' in GetInfo. Where to fix it. Please help.

Unknown said...

yes many new things are iphone apps and others.Get hire iPhone developer with expertise in various iPhone technologies like HTML 5, iOS 5, iPhone SDK, iPhone simulator and Xcode so as to ensure the best iPhone development solutions.

iphone apps development

Unknown said...

No Doubt, nothing is perfect everything want to reform time to time in this world. After time to time, users want to use something new. iphone app development takes revolution in mobile technologies but these also passé s through reconciliations process.