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

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

Related

pushsharp push notification to iOS error with the certificate

Hi all I am new to iOS development, I have put in the deep end to get push notifications. I found pushsharp and was using this tutorial
Tutorial I a using
I have used a windows application instead of web application and add the latest pushsharp. The code build and runs but i get the following exception
The error happens at the following location
I have revoked my certificate and recreated it several times and also i have tried exporting the certificate and the key. Both give me the same error.
When I am creating the certificate, I created one for iOS Development in Apple portal.
This is what I have tried so far
Based on comment from Jack Hua, i have tried the following
Logged into apple portal and deleted
App ID's
Certificates
Provisioning profiles
Xamarin visual studio has no provisioning profile as expected
Starting with a Clean slate
Key Chain access
Request certificate from certification authority (Code Signing)
save the cert signing request
Registered a new app with bundle identifier and push services enabled
Add new provisioning profile
create certificate
Use the certificate signing request created (Step 3)
download certificate
Double click on the certificate to install into keychain
(Keychain has new entry now)
Right click an export a p12
(If I do not do this I wasn't able to see the certificate in the provisioning profiles section)
Select the certificate and create the provisioning profile
Re-open Xamarin studio and the provisioning profile is shown in the project properties
Now create the APNs develpment certificate
Key Chain access
Request certificate from certification authority (APNs)
Save the cert signing request
Select the app id created (Step 4)
Edit App ID
Under push notification select create certificate
Select the certification signing request(Step 14)
Download the certificate
Double click on the certificate to install it
(Now two entries show in Keychain certificates, one for code signing and another for APNs)
Select the APNs certificate in keychain access and export .p12 file
Include this in my sample project
(Create as per the youtube video with appropriate device token)
I still get the same Apns connection error.
What am i missing?
Based on Jack Hua comment I have further made this attempt.
I have set the validation flag to false, I still get the connection error however the inner exception is 'Invalid Device Token'
Made a bit of progress after some research, the device token i had has spaces removing the spaces i do not get any errors however the notification is never shown on my iPad. I am using Sandbox and iOS development certificates, provisioning profiles. Wondering is this a know issue in development and it will work in production. Any help is greatly appreciated guys!!!
That error message is generated when creating an ApnsConfiguration object, see source code.
if (!Regex.IsMatch (commonName, "Apple.*?Push Services")
&& !commonName.Contains ("Website Push ID:"))
throw new ArgumentOutOfRangeException ("Your Certificate is not a valid certificate for connecting to Apple's APNS servers");
You are not creating a push certification... The tutorial you are following is creating a distribution provisioning profile that allows you to submit your app to the Apple App Store (not notification).
You can follow this document to generate a notification certification and config your app to enable the ability of push notofication.
Refer: send-push-notification-to-ios-pushsharp-certificate

Renewing Apple Certificates

As usual, Apple's over-complicated procedures are driving me mad.
We have an app that uses Push Notifications (amongst other certificates). This ran out 2 months ago but we have been unable to get a new certificate working which is, needless to say, ridiculous.
I have added new certificates to the Apple ID Developer account, generated p12 files, added to Keychain, converted to .pem file, etc but the app still fails. I don't know if we are generating the wrong certificate or storing in wrong place or not linking it to app etc.
Can someone please make themselves a hero for all us standard app developers by listing the full and precise steps to getting new certificates found by Xcode and the app build?
Thanks.
LATEST
Ok so still a duff app. Have cleared certificates, made new provisioning profile, made new certificates, added to keychain, copied to system keychain (whatever that is but they seemed to be there before)....
Errors are as follows.
Target > Capabilities > Push Notifications
Target > General > Signing
Both say 'Provisioning profile "xxxxxx" doesn't include signing certificate "iPhone Distribution: xxxxx. (M........6)'
Don't know what I should be doing with anything after adding to Keychain and no idea why I can't add certificates to a profile. Push Notifications is enabled on App ID.
Here is the full and precise steps to getting new certificates you want.

iOS: Send Push Notification from AWS SNS to APNS

My AWS SNS stopped sending push notifications to my subscribers on iOS and I am trying to understand why. So I started from scratch with the aim to deliver 1 notification to my test device.
I have done the following:
Create new certificate on iOS Dev Portal of the new "Apple Push Services" type, not the old "APNs iOS Production", imported to keychain, exported certificate and private key, added those to AWS as described in the AWS SNS APNS instructions.
Confirmed that this new APNS certificate shows up in the "Production SSL Certificate" list in my App ID on the portal.
Create "iOS Production" application in AWS SNS and load the credentials above.
Build the app for my test device, subscribe to notifications, get the token and strip all spaces etc. and with that token create a new Endpoint on AWS SNS.
Select that single Endpoint and send a message to it.
I just get this error in the CloudWatch Logs:
"providerResponse": "NotificationErrorResponse(command=8, status=InvalidToken, id=1, cause=null)"
I've been through this process a few times, created new certificates, tried with old ones, reinstalled the app several times, etc. etc. I even ran across this issue of the Apple CA certificate expiring today as I saw most of the certificates on my Keychain appearing red with the message "This certificate has an invalid issuer" but apparently this should not be an issue according to Apple (also the above did not work from yesterday).
I feel like I have exhausted the research I can do here.
What is it that I am missing?
Or how can I debug this? I using the credentials I can successfully "ssh" to the APN server, is there a way to interactively figure something out there?
UPDATE:
It could be that I'm trying with the "production" certificate but on an app Im' building from Xcode? Isn't this new certificate supposed to work for both the Sandbox/dev and production version?
The most direct way to answer this question is to answer this:
It could be that I'm trying with the "production" certificate but on an app Im' building from Xcode? Isn't this new certificate supposed to work for both the Sandbox/dev and production version?
In simple terms... Not really. You could try to pull this off but it gets weird. You have to create an ad hoc distribution and load that onto your phone to get this to work. Every time you click run in Xcode, it runs the release certificate (AKA the Development Profile. Unless you've changed this in the scheme settings. You can't run a production APNS with a development certificate.
To expand - The production push-notification certificate matches the distribution provisional profile - the sandbox push-notification certificate is for the developer provisional profile
Anything run from Xcode to your phone runs the developer profile and will except the sand box certificate. Once you click Archive - you should have Distribution set for your archiving in your Manage Scheme settings

"No Certificates are available" when adding iOS provisioning profile for Parse Push Notifications

I'm following this tutorial to set up push notifications for my iOS app, using Parse. When I get to part 2, which involves creating a new Provisioning Profile, I get to step 6, and see this:
When I look at my certificates however, I see that there is in fact one there:
I've tried following other stackoverflow posts that address this issue, and it doesn't seem to fix my problem, perhaps because the layout for the Appe dev website seems to have changed a bit. Why aren't I able to create a provisioning profile to set up Parse Push Notifications?
The certificate you created is intended to be uploaded to the Parse website, in the settings section of your app. You need to create a separate certificate to go with your provisioning profile. Create a new certificate, and select either iOS App Development, or App Store certificate, depending on what stage you are at. I'm assuming it's Development in this case. You don't need to attach the Push certificate to your provisioning profile.

Certificate stuff in iOS MDM operation

Now I'm trying to make an MDM server which manages iOS devices using APNS push notifications.
So far I went over number of Apple official documents about configuration profile, mdm protocol, APNS push and etc.
But some of the steps necessary for the MDM full flow, I can't figure out clearly.
APNS certificate which MDM server has to use for push notification
Who(Vendor? or customer?) creates CSR and who(Vendor? or customer?) generates APNS certificate by uploading the CSR in Apple Push Portal?
(What the Apple document says and what Google says are not matching each other..)
Identity certificate which has to be contained in Configuration Profile
How to create the identity certificate and in where?
How to include it in the Configuration Profile using iPCU?
Searching on web I could see pretty lots of information about these but not all of them says consistent answer, so I got to feel more dizzy. :-(
Any piece of help/information will be appreciated.
Thanks.. :-)
I have some basic points in order to generate a MDM certificate.
MDM certificate is use to manage the enrolled device.
The policies will work over the air(APNS).
The Server-Clint communication will happened through APNS.
I am going to answer your questions below.
Q: APNS certificate which MDM server has to use for push notification:
A: In order to manage the iOS device you need to install the profile in server.
First of all you need to create the CSR in your server using IIS manager.
After generate the CSR file you need to sign by any third party vendor,then you will get the .SCSR file. Hear the vendor will sign your CSR using a private key.
Once have the .SCSR you need to upload the file to apple push cert site.
After upload the SCSR file you will get the .PEM file.
Once have the .PEM file need to complete the request using IIS manager.
Your certificate will visible in the certificate list.Right click on the certificate and export with password.
Hear the customer means whoever creating the CSR.Vendor means the certificate whoever signing.
Feel free to ask the questions if you are not clear.
I have prepared some basic steps for you to configure Push notification as follows :
Go to Developer.apple.com
Check with Member centre
Navigate to iOS provisioning portal
check if app id exists
Create new app id
select created app (configure)
Enable push notification and in app
CSR from apple MAC user with keychain app(give account creds)
Enter CSR and generate
Download production certificate
Give this to MAC user again to generate p12 file
Provisioning go to distribution
Create New Distribution profile
Profile name is “APP name (space) Dist”
Hope this will help you.. Please feel free to ask if anything is not clear to you.
You can't much info regarding this. But I will tell you, use iPCU for creating config profiles. Use a server for sending these config profiles as a response.
Use a separate server for CA and issuing the authority.
You(Vendor/Customer) have to create a APNS certificate and you have to use it in the server, for sending push notification.
Let me know whether you have found a breakthrough or still you struck somewhere

Resources