So you’re in XCode 4, you have your project ready for deployment, you have your app store distribution certificate installed into your keychain and your app store provisioning profile imported into XCode. You can successfully build with your developer certificate, and now you’re ready to build and sign with the App Store certificate. You’ve created an App Store configuration and specified your App Store certificate in the Code Signing section of your build settings, for that App Store Configuration. You’ve done everything right, to put it succinctly. You choose your device scheme and then Product -> Archive. It all goes swimmingly until you see this:
Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
It turns out the problem can be super simple. You want to get to the Run Options dialog – Option-Cmd-R. Choose Archive on the left side panel. Choose App Store as your Build Configuration (for me, it was still Release). Now you can just hit the Archive button, or just hit Done and Archive from the menu as normal. That’s it. XCode was just building with the developer certificate, even though it appeared you had the App Store specified.