Did you find this helpful?

Push Notifications for iOS


This guide assumes you are familiar with the concepts covered in our Push Basics guide.

Configure Apple Notification Channel

  1. Ensure you have an active iOS development (APNS_SANDBOX) or production (APNS) certificate. If you do not, create one from the Apple Developer Portal under Certificates, Identities and Profiles:


  2. Export the certificate of your choosing (development or production):

    • Begin by downloading a copy of your certificate from the Apple Developer Portal under Certificates, Identities and Profiles. This will create a ***.cer file.
    • Open and install the certificate into your Keychain Access.
    • View your installed certificate under the Certificates subcategory.
    • Export your Keychain Access Certificate to ***.p12 format:


    • Convert the .p12 file to a .pem file using the following console command:

      • openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts
    • Once you have the .pem file. You can upload this directly through the Game Manager under your title's settings > Push Notifications.
    • Alternatively, use the generator below to craft request JSON for SetupPushNotification:

Select platform

Application Name

Enter the name of the application sending the message (application names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, hyphens, and periods, and must be between 1 and 256 characters long). Note that this must be unique.

PEM Certificate / API Key

For iOS (APNS or APNS_SANDBOX), copy the complete contents of your PEM file below.


Once the JSON is generated, use it to execute a call to SetupPushNotification. The response should look like this:

    “code” : 200,
    “status” : “OK”,
    “data” :
             “ARN” : “arn:*******/GCM/your_game_name”

  1. Congratulations! You have now configured your title’s iOS messaging channel.

Registering your iOS Client for Push

For iOS, developers will need to rely on the default behavior of how iOS handles push notifications as PlayFab does not offer a native implementation on Unity at this time.

By default, notifications received while the game is in the background will be routed to the notification area. Alternatively, notifications received while the game is the active app will be received silently, and will not be visible in the notification area.

  • Code from Sample, ran on client Start():

// must be called before trying to obtain the push token
// an asynchronous call with no callback into native iOS code that takes a moment or two before
// the token is available. (so spin and wait, or call this one early on)
// this will always return null if your app is not signed
UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound, true);

byte[] token = UnityEngine.iOS.NotificationServices.deviceToken;
if(token != null)
    RegisterForIOSPushNotificationRequest request = new RegisterForIOSPushNotificationRequest();
    request.DeviceToken = System.BitConverter.ToString(token).Replace("-", "").ToLower();
    PlayFabClientAPI.RegisterForIOSPushNotification(request, (RegisterForIOSPushNotificationResult result) =>
        Debug.Log("Push Registration Successful");
    }, OnPlayFabError);
    Debug.Log("Push Token was null!");

  • If no errors occurred, congratulations! Your iOS client has been successfully linked to your title’s Apple notification channel.

Troubleshooting iOS

  • Verify that you have valid .pem files.
  • Ensure that the same certificate used in SetupPushNotification is used by XCode to sign your app.
  • Ensure that Push Notification API is enabled for your build in XCode.
  • Ensure that your signing certificate matches the PlayFab platform. When running SetupPushNotification , use OverwriteOldARN = true to rebind the channel to a new platform. Only one iOS environment (APNS or APNS_SANDBOX) can be active on a title at a given time.

Additional Support

For help, example bugs, and related questions, drop us a line over at our support forums.

We currently only support our services for the standard flow described in this document. If your team is looking for additional functionality with other common Push services or plugins, please let us know! We love getting feedback from our developer community.

Did you find this helpful?