84

I have created the app id with APNS enabled and I configured both development and production certificate

Now when I create entitlements it is always displaying development even If I change the Provisioning profile to iTunes deployment also the entitlements is displayed as development

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
1

3 Answers 3

112

You can't use a production certificate in debug/development. Even if you do it, then, when you 'Archive', Xcode will automatically set it to production (Apple reference). You can see this when you try to submit your app to iTunes connect for TestFlight/Review or for Adhoc deployment.

Xcode 8: Xcode 8

Xcode 9: Xcode 9

9
  • 3
    when i run my app from xcode, push notification works, but when i upload the build to appstore and download it for testing using testflight it won't work. Aug 16, 2017 at 13:05
  • 2
    @AbhishekPandya on you push server you must change from developer to release certificates to test with TestFlight and make it work with official AppStore release.
    – Shebuka
    Aug 17, 2017 at 12:39
  • So true, that's why I keep seeing inconsistent behaviors between Xcode app and TestFlight app May 14, 2018 at 23:10
  • Isn't there a way to edit info.plist so you don't see this screen when uploading to the App Store?
    – Crashalot
    Sep 12, 2018 at 8:53
  • 2
    It's automatically updated by Xcode according to Apple doc
    – DawnSong
    May 14, 2019 at 11:58
15

XCode 10.2:

If you change your target to "Generic iOS Device" before Archive it will set the aps-environment variable to production. If you archive with the target set to your device it will archive with the aps-environment variable set to development.

14

There is a known bug in Xcode whereby manually setting this to 'production' causes Xcode to display an error next to your entitlements config with a 'Fix Issue' button. Clicking this sets it back to 'development' This is not intended functionality. As I said it is a known issue and I believe I filed a radar when I first discovered it.

It has been fixed in Xcode 8.3 beta 2. In the meantime, manually set it to 'production' and then ignore the error Xcode gives you, your project will work just fine.

8
  • 1
    If I do this am not able to archive
    – AJ Sanjay
    Feb 17, 2017 at 8:28
  • great! my adhoc build was not getting uploaded to the device. After I changed from "development" to "production", it worked. Thanks a lot. Oct 6, 2017 at 9:43
  • 7
    Note that Xcode will automatically change development to production now when you archive for release. You can confirm this when you review the IPA for upload.
    – jwinn
    Feb 9, 2018 at 20:29
  • 1
    I'm on Xcode 10.3 and I still have this issue. Glad to know that it will automatically use production when archiving it.
    – CyberMew
    Aug 13, 2019 at 10:12
  • 2
    There's no more error on Xcode 13 but the APN environment setting of "production" is not respected. Xcode always build the app with "development" setting in debug mode. You can verify it by opening the package of compiled app, and find the embedded.provisionprofile file inside of it.
    – Jonny
    Dec 10, 2021 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.