I've searched all over the google for a solution which works for me... I've tried SO many different suggestions.. but nothing seems to be working.
In xcode 4.2 using ios5 when I try to run the project, I get the following error
CodeSign /Users/matt/Library/Developer/Xcode/DerivedData/myapp-apjchwtbrxazuighfwhrzxchpcfk/Build/Products/Debug-iphoneos/myapp.app
cd /Users/matt/Desktop/myapp_v1_1
setenv CODESIGN_ALLOCATE /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/codesign --force --sign "iPhone Developer: Richard Sawyer (JCC5D2QGAM)" --resource-rules=/Users/matt/Library/Developer/Xcode/DerivedData/myapp-apjchwtbrxazuighfwhrzxchpcfk/Build/Products/Debug-iphoneos/myapp.app/ResourceRules.plist --entitlements /Users/matt/Library/Developer/Xcode/DerivedData/myapp-apjchwtbrxazuighfwhrzxchpcfk/Build/Intermediates/myapp.build/Debug-iphoneos/myapp.build/myapp.xcent /Users/matt/Library/Developer/Xcode/DerivedData/myapp-apjchwtbrxazuighfwhrzxchpcfk/Build/Products/Debug-iphoneos/myapp.app
/Users/matt/Library/Developer/Xcode/DerivedData/myapp-apjchwtbrxazuighfwhrzxchpcfk/Build/Products/Debug-iphoneos/myapp.app: object file format unrecognized, invalid, or unsuitable
Command /usr/bin/codesign failed with exit code 1
I have tried
- reinstalling xcode
- deleting the DerivedData folder
- adding resource location files (somewhere?!)
- checking for duplicate info.plist files
- creating a symm (?) Link to the code sign folder
- other random little bits and bobs
It seems nothing is working! I don't think I changed anything for this not to work. I was testing on my iPhone 4S, then tried on an iPhone 3G (os 3.1.2) - I actually changed the settings to add armv6, but have tried to change this back with no avail.
I'm not sure what I can do now?!
Thanks for any help.... anything at all!
My problem turned out to be the wrong setting in Build Options
.
I had entered armv6
and armv7
as settings in there. I changed these back to normal
and it built fine.

Check the organizer/devices listing of mobile provisionings to make sure you have a provisioning that corresponds to "iPhone Developer: Richard Sawyer (JCC5D2QGAM)" and is valid. In any case, probably want to go through the iTunes Provisioning Portal and follow every direction from the beginning absolutely precisely.
Here's the comprehensive DTS Tech Note on all things CodeSigning-related:
来源:https://stackoverflow.com/questions/8052925/xcode-4-2-ios5-codesign-failed-with-exit-code-1