RemoteNotification Help

This is my second swing at this topic.
I did everything described in the Apple Developer portal, but I didn’t get a .p8 file I got .cer file. How do I get a .p8 file?

I’m also not seeing how to setup the iOS side to register for remote notifications.

Finally how do I get the device token for my app?

Sorry if this is all readily available information. I may just be overlooking it.

Help would be greatly appreciated.

As I recall, The first time you create the certificate, it will let you download the p8 file containing the public and private key. After that first time, it will only let you download the public part as a crt file.

Device tokens come from the individual devices themselves. To get this, you’ll need to add the NotificationCenter object to your project and implement at least the AuthorizationSucceeded, NotificationReceived, Error and RemoteRegistrationSucceeded events.

When your app launches (app.Opening) you should call the NotificationCenter.RegisterForRemoteNotifications method. Apple’s instructions say that while this identifier probably won’t change, it may, so you’ll want to remember what it was previously and if it ever changes, update the value on your backend server.

If successful, you’ll get a token in the RemoteRegistrationSucceeded event. If not, the Error event will fire.

Ok, I just went to my personal account and the procedure for creating the p8 file is:

  1. Select Certificates, Identifiers & Profiles
  2. Click Keys on the left-hand side
  3. Click the + button next to Keys
  4. Give the key a name and check Apple Push Notifications service (APNs)
  5. Click the Download button.

When I do that, the file that is offered to me is called AuthKey_XXXXXXXXXX.p8 where the X’s are replaced with your company ID. If that’s not what you got, I suggest clicking the Revoke button and then creating a new one. They’ll only let you have two of these in existence at any given time to allow you some overlap when upgrading to a new key, so make sure you’re only using one at any given time during normal production.

Thanks Greg, I’ll step through all this again this Weeknd.
Wish me luck.