Xcode builds wrong archive

I've been seeing "Upload to App Store" operations fail, with any of several messages. One scenario that seems to crop up repeated is that when I build an iOS target archive (the usual way Product -> Archive), the upload is rejected because it's configured for a development APNS certificate instead of the production one.


You can look at the entitlements before uploading, and when this happens I see that the entitlement says "development". If I merely build the archive again, changing nothing in Xcode, then the entitlement correctly says "production". It's as if, after building a debug configuration for regular testing, Xcode builds the archive incorrectly, at least the first time.


Does this ring any bells for anyone? It's kinda annoying, and time-wasting.

Try toggling/setting all/both debug and release code signing/code signing identity to iOS/iPhone Distribution, then option-clean the build folder and go again.

Xcode builds wrong archive
 
 
Q