The APNs certificate provided does not match the current environment - ios

It's my first time to update one app in app store after implementing the Firebase push notifications in the project. I'm trying to upload the "Production Certificate" in Firebase Console, but it gives me this:
The APNs certificate provided does not match the current environment
I want to make sure that after updating the app users will receive notifications.
Any link with tutorial to update one app in appstore is welcome.

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 item - it worked.
Please refer to the answer given here

The other possibility is:
You are confusing the development certificate with Production one in the certificate list of Key Chain Access.
Try to "Export" from the correct one.
This is what brought me here :)

Related

What is a right way to generate the Certificates while using FCM

I am amazed to see that When ever I am creating Certificates "Apple Push Notification service SSL (Production & Development)" it is not shown in Profiles
Things are very much changed on Developer portal And after bashing my head many times (deleting and creating different certificates) its is not working for me
What I am doing:
Attempt 1: When I create certificates from certificate menu it did appear on Profile menu (from where we create provisioning profile & selects certificates) but when I create APNs SSL certificate it never appears in provisioning profile menu
Attempt 2: I created separate SSL certificate and created p12 file from them and uploaded them into FCM server and then i created normal certificate and generated Provisioning profile and installing them in xcode it gives me error of not including something for Notification.
So after trying all these I am now not able to run app on device and not able to work around for FCM notification
Question: What steps are needed to create certificate while working on FCM?
"NOTE: Since all interface and working procedures are updated on developer portal is updated so all help on SO and other places are out date. Please let me know what should I do and how it is done in precise manner it will be great help. THANKS"
I suggest to use for push notification, .p8 key because this same key will work for both sandbox And production mode.
Use this solution to generate .p8 Key And upload key on firebase read this articles

'The certificate bundleId did not match that of your app' Firebase Cloud Messaging

I am trying to integrate remote push notifications in iOS using Firebase, but I have run into an issue. When I upload my Development APNs Certificates, I get this error: 'The certificate bundleId did not match that of your app.' I don't understand why I am getting this issue and some help would be much appreciated. For some context, the file I am uploading is called 'Certificates.p12.' This was created when I exported my Certificate downloaded from my developer account. One possible issue I found is that I might have to upload a file called 'CertificateRemoteNotifs.p12.' The only issue with this is that no such file exists on my computer and I am not quite sure as to how I could get one. Other than that, I have no idea.
I think it is much better if you switch from Certificates to keys.
Check here how to generate it.

Firebase: Cannot upload production APNs certificate

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?
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:
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
Don't select private ket in key chain, directly select certificate and create production certificate.
1) Don't select private ket in key chain.
2) Directly select certificate and create production certificate
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.
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.
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...
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:
1. No development APNs certificate
2. 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.
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.

Make Parse Push Production Certificate - iOS

I am trying to make Push Certificate for Production so I am following the instructions here https://parse.com/tutorials/ios-push-notifications, but in step 2, it says it should have a name of
Apple Production IOS Push Services
As I have changed this for production as it says to do in the note
"Note that you've just enabled Push Notification for your app in development mode. Prior to releasing your application on the App Store, you will need to repeat steps 1 through 7 of this section, but select "Production Push SSL Certificate" in step 2 instead, as covered in Section 7."
But mine comes out as
Apple Push Services
And then in section 2 and 3 when I try to add my .p12 file it says
Why is this happening and how can I set up Push with Parse for Production.
Thanks
It seems that Apple has changed the common name that they are embedding in the production push certificates that they issue. This seems to be related to the deprecation of the older binary push service in favour of the new HTTP/2 service.
A certificate I issued earlier in the year has an common name of "Apple Production IOS Push Services: appname" while a certificate I just created has a common name of "Apple Push Services: appname". Parse seem to have verification code that checks the certificate common name and this code does not accept the new name format.
There is nothing you can do on your side; Parse will need to update their code to accept the new certificate name.
You're creating one of the new "Universal" certificates. Now you don't have separate certificates for Production and Development - just one certificate for both.
These certificates have a different name to the previous format. Perhaps the Parse control panel has not been updated to handle this yet.
https://developer.apple.com/news/?id=12172015b
I'm assuming that you already created "Certificate from a Certificate Authority".
You need to open Keychain Access program. It is located in your Utilities folder in your Applications folder.
After you create your push certificate (the one you download in the developer portal), click it and install it into your keychain.
When you do, it will show up like this:
This is what Parse means in the instructions by it will have the name "Apple Production IOS Push Services"
Next, you will want to right-click your Production push certificate and click "Export Apple Production iOS Push Services":
Then it will take you to this screen to enter a password. DO NOT enter a password. Just click OK:
Then you will be asked to enter your system password. This is the same password that you use to login to your computer when you first turn it on. If you don't know it, then find out because you will need to know it to generate the p12 file.
Then name your P12 file:
This is the file that you will have to upload to Parse for production.
To create development P12, it is exactly the same. In fact, you should create your development p12 first, so you can test it on your development app.
Its because Apple announced a new HTTP/2 based provider API and simplified certificate management process thus changing the way these certificate were named (From Apple Production IOS Push Services to Apple Push Services), and Parse needed to update their system to allow for such certificate to be verified. Thats why you were getting this error. You should try again now, it seems to be working, mine just went through.
Happy Coding!

How to change production certificate (.p12) after application is in appstore

Certificates, provisioning profiles and setting Apple Push Notification is the part I could never grasp fully since first day. I believe a lot of people are having similar issues looking at SO questions. Unfortunately after long approval process and finally the app being in Appstore, my apps push notification is not working. While in development, the push notification was working perfectly. I guess I made a mistake in setting production certificates just before app store submission (most probably the reason was my frustration with this subject - or my lack of knowledge - we will find out..)
Now the technical part:
I submitted my App with the APN certificate labelled as 1. After we figured the PN are not working, I created the certificate labelled as 2. I will talk about it later.
And here is the Keychain access screenshot from the computer I created the certificates from (The labels are matched with the above certificates image):
As you can see, the certificate 1 doesn't have a private key attached to it. (Is this a problem?!) I don't know how it happened or if I have deleted it by mistake or never created it in the beginning. All the rest have private keys attached to the certificates.
Thinking that this must be the reason for the PN not working, After the app was in Appstore, I created a new APN certificate labelled 2. This time with a private key attached:)
And here is how I export the certificate and private key couple to a .p12 file. I don't think this part is wrong since it is the same procedure I used for development .p12:
Whatever I tried, (I exported every possible .p12 combination of the 4 certificates and 3 private keys and embedded them to our server) Push notifications are not working.
So my question is:
Do I have to re-submit my app to the Appstore again with brand new certificates? This would be really bad since the people who downloaded the app will not have Push notification functionality for another at least 12 days. (thats how long it took Appstore to review last time)
Is there still a chance that I can play with the Apple Developer Console and alter/create new certificates/provisioning files/APN certificates and get this thing working without the need for a re-submission.
Thanks for reading the somehow long question. Any help/thought would be appreciated.
No, there is no need of re-submitting the app.
For certificate 1 - yes missing private key means certificate is not correct.
where as certificate 2 you can again export .p12 file or you can create a new certificate and create .p12 file.
and yes, you can play around for .p12 file.

Resources