These few days has been haunted by this error. Finally I found the reason and solution of getting the compilation error in Xcode 3.2.3 and 4
Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
The reason is because the Validate Built Product that has been introduce since SDK3.2. Just set it to NO, and only turn it on for Distribution configuration should be alright again.
Really make my ass pain.