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.
Related
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
I can't upload my production APNs Certicate on Firebase. There was an error reading your certificate.
I can't find out the cause of this error.
You should select only the certificate and don't select the private key . See this screenshot
I experienced the same issue before due to not proper "Certificate Signing Request". You may miss the Common name when you create a "Certificate Signing Request" or you may mentioned any other mails that didn't include in your xcode as developer Account.
Please try to put a common name and do the process again to create a new APN Certificate.
I think you make some mistake's to create the certificate. Follow this link to create certificate correctly and try.
In my case I have faced this issue because I was exported 2 items Apple Development Push Services along with private key, and uploaded .p12 file to firebase. Then it said there was an error reading your certificate.
So the solution is don't export private key along with Apple Development Push Services item. Now generated .p12 file uploaded in Firebase. And the upload was successful.
Hope it will help to someone.
I'm trying to set up push notifications through Amazon SNS in Unity.
I have the Android side of things working perfectly but we're having issues with iOS. I am able to get the device to register to a Apple Production SNS application and subscribe to a topic but as soon as I attempt to send a notification the endpoints "Enabled" status becomes "False".
I read that this could be due to the certificate being set as Production although we followed the instructions on creating a Development certificate, when I try uploading the .p12 file to create an Apple Development platform in SNS it always gives an error saying:
"You provided a certificate of type iOS Production"
We have tried multiple times to download the development certificate and tried rebuilding the app with a new bundle ID and new app on the Apple development site without touching the production button but it always ends up being a production certificate after exporting the .p12 from KeyChain...
Also, every .p12 we have created had the exact private key and certificate as the last.
What could be going wrong?
This Worked for Me:
1 - Download the Certificate from Apple (APNS Certificate for Development or Production)
2 - Double click on your Certificate to open it in your KeyChain
3 - Select it, Right-Click on it and press EXPORT "Cer" *** DO NOT SELECT IT TOGETHER WITH YOUR PRIVATE KEY, Select it By ITSELF!
4 - Name your new p12 and Upload this to SNS in the Setup Stage
DONE, this will work!
---> Its weird that Amazon's SNS requires a NON-Signed .p12 instead of the Combined .p12 (including private key) like other platforms, but... Go Discuss with Amazon...
This worked for me;
Follow the steps in this guide;
http://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html
Now in SNS when creating DO NOT upload the p12.
Open up the files generated in step 2 & 3 in a text editor.
Copy the certificate from the .pem generated in step 2 into the certificate text area.
Copy the private key from the .pem generated in step 3 to the private key text area.
It should create. My guess is that some old certificate was being tagged along in my .p12 file.
I am facing one issue when I am trying to confiure the GCM and getting configuration file. When I am trying to upload the production certificate over the GCM portal it says "Bundle Id in certificate doesn't match with Bundle Id you entered". I verified already for the same. Still no joy. Anyone help plz.
For my case, I have to export a cer not a private key.
I had the same problem but for different reason. It turns out that the .p12 file has something wrong. If I export .p12 file from Keychain Access by selecting both certificate and key and export 2 items together, it doesn't work. I need to export the certificate and key separately and merge them later. Use terminal to merge two files:
cat cert.p12 key.p12 > cert_merged.p12
I have been getting same exact problem in Firebase (FCM).
The only solution which has worked for me, which I found by hit and trial is while exporting the Cert as the P12, only select the Cert but don't select the Key.
You will still be able to export only the Cert (without the key) as a P12 file and set the password in a similar way.
Now uploading this P12 file with the provided password works for me.
Make sure to export only the certificate not the key... by clicking on the triangular/caret dropdown icon and deselecting the key
I tried it with both Development and Production .p12, both worked for me.
You need to make sure you generate a correct .cer certificate file from your Bundle ID, and need to make sure you export the correct .p12 file from your Keychain Access. You can view the sample steps in this page.
You need to make sure the iOS Bundle ID you input in the GCM portal.
(I use mine com.ziyang.samples.quickstart.gcm)
matches the Bundle ID in your Apple Developer Portal.
(I use mine com.ziyang.samples.quickstart.gcm)
If I miss typed the iOS Bundle ID in the GCM portal, it will show the below error:
Make sure you're using your APNS certificate and not your regular development or production certificate. Just spent an hour on this until I realised my mistake!
if you sure you set the right bundle id You can solve it by:-
1-Export only private key as p12.
2-Export only CERT as p12.
3-Export CERT with private key as p12.
and try one by one to solve this issue
Please select the Certificate instead of the key in the Keychain Access while exporting it to .p12.
A Password is Required when exporting the development certificate. The Development certificate would not upload with any of these suggestions until I added a password. I was, however, able to upload the Release certificate without a password. I also used the suggestion of #Sur Max to only export the certificate and not the key.
Currently, I have one app publishes in the appStore and I don't know exactly why the push notifications are not working. Something is wrong with the .p12 file in my server because when my server try to generate a push and send it to Apple Environment, I can see next error in my log:
02-27 11:42:11,868 [IOSPushNotificationSender] ERROR javapns.notification.PushNotificationManager - Delivery error: javapns.communication.exceptions.InvalidCertificateChainException: Invalid certificate chain (Received fatal alert: certificate_unknown)! Verify that the keystore you provided was produced according to specs...
2013-02-27 11:42:11,874 [IOSPushNotificationSender] ERROR camMan.server.mobile.ApplePNSSender - javapns.communication.exceptions.InvalidCertificateChainException: Invalid certificate chain (Received fatal alert: certificate_unknown)! Verify that the keystore you provided was produced according to specs...
Ok, I've tried to generate a new .p12 file but I don't remember exactly which one was the original certificate (.cer).
I've tried to download the (.cer) from the provisioning profile but when I open it with keychain access, this certificate hasn't got any private key.
So, I am lost, I don't know what can I do...Can I generate a new .p12 file without to have to modify any certification or whatever in my app? I don't want to upload a new version of my app in appStore...only I need to know how generate or download or whatever to set a new and valid .p12 file and send again push notifications.
Also I've checked all the settings in provisioning portal and everything is Enabled,Active like others apps that I have...so I think the only problem is the .p12
Also I still have the same key/paswoord of the p.12...only I've lost the CSR (.cer).
It sounds like the private key is missing on your machine - either it was deleted, or it belongs to another Mac.
In either case, you can simply revoke the existing vert and create a new one by uploading a new CSR (created by the Keychain Access app on your Mac).
Without a private key, your certificates and provisioning files are worthless. Revoke them all, delete them all, and regenerate new certificates and provisions after carefully re-reading Apple's documentation on the topic. You must modify the Build settings in your Xcode projects to use the new ones if it doesn't do this automatically. This won't affect apps already approved and in the App Store.
Since you had push notifications working during development phase are probably familiar with the procedure of installing certificate to your server.
You can create and install a new certificate whenever you want if you lost your old files.
Two things you have to keep your eye on:
development phase:
you are using Development Push SSL Certificate
your target server is: gateway.sandbox.push.apple.com
production phase:
you are using Production Push SSL Certificate
your target server is: gateway.push.apple.com