question

Tommy Li avatar image
Tommy Li asked

Instruction on using Admin API to set up iOS Push Notification

I did some adequate amount of digging, so hopefully you don't have to.

1. Follow Push notifications for iOS till you reach the point where the PEM file is converted from the P12 file you exported from Keychain Access. You can try following the instruction to upload the PEM file. If the uploads fails for unexplained reasons, keep reading.

2. Use a text editor to open the PEM file. You can see two sections of strings, one is certificate, the other is private key.

3. Copy the certificate text to a separate empty text file (for convenience). Do make sure to also copy "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" markers. Then use the replace method of the text editor to convert all line breaks into "\n" exactly, so that it becomes a single line string. This is not mentioned in any PlayFab official documentation (please prove me wrong)

4. Repeat the process for the private key section. Keep the markers and convert all line breaks in the key text.

5. In an environment where you can call PlayFab API (be it Postman, a .NET Core console app, or just an Editor script in Unity), include the Admin API and call SetupPushNotification.

- Set the "Key" property of the request to the certificate string

- Set "Credential" property to the private key string.

- If the certificate is the newer "Apple Push Notification (Production & Sandbox)" one, set "Platform" property to APNS.

6. Run the API call and profit. Do keep an eye on the API response in case some other errors occur.

apisPush Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

Thanks for the instruction! Are you indicating that the "upload PEM file" page on Game Manager maybe problematic? If that's the case, can you help us troubleshoot this issue by sharing your thoughts on possible causes? Thanks.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.