I am adding push notifications to an app that I distribute to my team via TestFlight. I've created both a development and distribution certificate for APNS, and I re-issued my development and distribution provisioning profiles with the additional aps-environment
entitlement.
When I archive my app, I can choose the "Export" option.
- If I choose "Save for Ad Hoc Deployment", Xcode signs the app using my distribution provisioning profile.
- If I choose "Save for Development Deployment", Xcode signs the app using my development provisioning profile.
- If I choose "Save for iOS App Store Deployment" OR click on the "Upload to App Store..." button, Xcode signs the app with the
XC: *
wildcard provisioning profile which does not include theaps-environment
entitlement.
If I delete the XC: *
provisioning profile from the developer console and try over again, I get an error when attempting upload to the app store:
An App ID with Identifier 'com.ionicframework.pro305288' is not available. Please enter a different string.
If I look at my Organizer and choose to validate one of my earlier releases, the XC: *
profile re-appears in my developer console and I'm back to square 1.
If I look at the version history of the app, all previous releases were signed with the XC: *
profile. I figured that the provisioning profile might be tied to the app ID, so I created a completely new app ID with all new certificates and provisioning profiles, but I had the same problem.
It doesn't matter if I manually specify the provisioning profile in the build settings either. Xcode always tries to use the same stupid wildcard provisioning profile for app store builds.
Main Question: How do I tell Xcode to sign my app with the correct provisioning profile when uploading to the app store?
Bonus Question: How can I tell which provisioning profile is used to sign my app when I run it directly on a device attached to my computer via USB?
EDIT
As requested, this is the code signing section of my build settings for my target.
The provisioning profile is currently set to "Automatic" but my issue persists if I change the selection to either my development or distribution provisioning profile.