Firebase: Cannot upload production APNs certificate
IosPush NotificationFirebaseApple Push-NotificationsFirebase Cloud-MessagingIos Problem Overview
I am currently testing an app in TestFlight and need a production APNs certificate in order to test Notifications in Firebase.
I have followed all of the steps in this video and successfully configured the development APNs certificate: https://www.youtube.com/watch?v=LBw5tuTvKd4
I've also checked that my steps following the Firebase support guide. Although I note that the Apple Developer site has changed slightly since this guide was written: https://firebase.google.com/docs/cloud-messaging/ios/certs#configure_an_app_id_for_push_notifications
I have generated a production APNs certificate at developer.apple.com using the same method as the development certificate but when I try to upload the .p12 file to Firebase, it gives me the following error:
"The certificate environment did not match. Ensure that you got the right development or production APNS certificate."
I'm definitely uploading a .p12 generated from a production APNS certificate, is there something else I need to do for a production certificate?
Ios Solutions
Solution 1 - Ios
Solved. The mistake I was making was that I was exporting the "private key" part of the certificate in Keychain Access instead of the "certificate" part. As soon as I re exported the .p12 using the correct row in the list - it worked.
Images to illustrate below credit iOS
Correct method:
Solution 2 - Ios
try this
make .csr file and download cert from developer.apple.com
while exporting select private key and certificate both at a same time and export to .p12 with any passphase.
upload tht .p12 file on firebase console.
Thanks
Solution 3 - Ios
Don't select private ket in key chain, directly select certificate and create production certificate.
- Don't select private ket in key chain.
- Directly select certificate and create production certificate
Solution 4 - Ios
I am facing the same problem and i have tried all above mentioned solution but nothing works for me than i delete certificate from keychain access and again download certificate and install it than export and try to upload it. It works for me.
Solution 5 - Ios
When I tried the solution suggested here, nothing works (This probably means I am doing right). I solved this issue by replacing Chrome (The application is running for a very long time) with Safari (I invoke the application just for this purpose) for the upload.
That means, if restart Chrome might also work.
FYI.
Solution 6 - Ios
In my case I wanted to upload a production certificate to Firebase, and after trying everything I finally realized that I had created a development certificate on iOS Developer...
Solution 7 - Ios
There might be an inssue of semantics in some cases, so pay attention to meaning.
When you have to upload the certificates in firebase console there are 2 boxes with placeholder text which read:
- No development APNs certificate
- No production APNs certificate
In my case, I had understood that I must not upload a development APNs certificate in box 1. Actually, firebase meant that no development Apns certificate has been uploaded yet and that I could upload my certificate.
Solution 8 - Ios
I was having this problem after my previous p12 had expired, I was trying to upload as a new certificate and was getting the “does not match the current environment” error but it uploaded fine once I updated the expired p12 with the new p12 instead of trying to upload the new one alongside the expired one.