10

Why do I get this message by Production APNS certificate?

"The certificate environment did not match. Ensure that you got the right development or production APNS certificate."

What is exactly 'The certificate environment'? Development APNS certificate makes no problem. I don't get it.

pearl7721
  • 320
  • 1
  • 12
  • [This](https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ProvisioningDevelopment.html) might help. You ought to be using a different certificate for your production version. `You can determine in Xcode which environment you are in by the selection of a code-signing identity. If you see an “iPhone Developer: Firstname Lastname” certificate/provisioning profile pair, you are in the development environment. If you see an “iPhone Distribution: Companyname” certificate/provisioning profile pair, you are in the production environment.` – Andy Sep 24 '15 at 17:46

2 Answers2

19

I had the same issue and here's what I did to solve.

The issue was because I generate both Development APNS Certificate and Production APNS Certificate using the same certificate signing request file (the file that you got from Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority). Apparently, the certificate signing request file should not be the same.

To solve this problem:

  1. Create a new certificate signing request (Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority)
  2. From the Push Notification section of your app, Create Certificate using the .certSigningRequest file you just created
  3. Re-upload the .p12 to GCM

Reference:

  1. http://blog.hypermkt.jp/uploading-certificate-for-google-cloud-messaging-for-ios/
  2. How to generate valid APNS Certificate (.p12) for use in GCM for iOS?
Community
  • 1
  • 1
yonasstephen
  • 2,645
  • 4
  • 23
  • 48
10

Had the same issue!

While exporting from Keychain right click on Certificate itself not on the Private Key inside of it.

chemic
  • 800
  • 7
  • 12