question

Nguyen Ngoc avatar image
Nguyen Ngoc asked

Push Notification AdvancedPlatformDelivery IOS,Push Notification IOS AdvancedPlatformDelivery

 
               

function pushNotification(PlayFabId) { const applePayload = { "aps": { "alert": { "title": 'Game Request', "subtitle": 'Five Card Draw', "body": 'Do you want to play poker', }, "category": 'GAME_INVITATION' }, "gameID": '01FA1A786' } return server.SendPushNotification({ Recipient: PlayFabId, AdvancedPlatformDelivery: [ { Platform: "ApplePushNotificationService", Json: JSON.stringify(applePayload) } ] }); }

i used this code to push Notification with some Customize Data in CloudScript, but it fail with error message :

"iOS Push Notification Failed: ValidationError 1 validation error detected: Value null at 'message' failed to satisfy constraint: Member must not be null"

,
 
               

const applePayload = { "aps": { "alert": { "title": 'Game Request', "subtitle": 'Five Card Draw', "body": 'Do you want to play poker', }, "category": 'GAME_INVITATION' }, "gameID": '01FA1A786' } return server.SendPushNotification({ Recipient: 'E01FA1A786D39B97', AdvancedPlatformDelivery: [ { Platform: "ApplePushNotificationService", Json: JSON.stringify(applePayload) } ] });

=====

I used this code in CloudScript to push a notification (IOS Devices), but it got an error :

"iOS Push Notification Failed: ValidationError 1 validation error detected: Value null at 'message' failed to satisfy constraint: Member must not be null"

Push 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

·
JayZuo avatar image
JayZuo answered

Currently, PlayFab only supports `aps` key. Custom keys and values are not supported. For iOS Push Notification, we will only need to provide the JSON string used as the value of "aps" key in the "Json" part of "AdvancedPlatformDelivery". For example:

  "AdvancedPlatformDelivery": [
    {
      "Platform": "ApplePushNotificationService",
      "Json": "{\"alert\":{\"title\":\"Game Request\",\"body\":\"Bob wants to play poker\",\"action-loc-key\":\"PLAY\"},\"badge\":5}"
    }
  ],
  "TargetPlatforms": [
    "ApplePushNotificationService"
  ]

So, in your code, you can try to change the "applePayload" as the following to see if it works.

const applePayload = { "alert": { "title": 'Game Request', "subtitle": 'Five Card Draw', "body": 'Do you want to play poker' }, "category": 'GAME_INVITATION' };

If you do need the custom keys and values, please feel free to post a feature request for it.

1 comment
10 |1200

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

Nguyen Ngoc avatar image Nguyen Ngoc commented ·

Thank for your help. It worked !.

0 Likes 0 ·

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.