universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

Unable to get user data from IOS Click #108

Closed matthewwwillard closed 5 years ago

matthewwwillard commented 5 years ago

Can't seem to access userdata, says it's not empty, but returns nothing on iteration.

Payload:

{

                                aps: {
                                    alert: {
                                        body: message,
                                        title: title,
                                    },
                                    badge: 1,
                                    sound: 'ping.aiff',
                                    data:{
                                        contestId:1
                                    }
                                },
                            data:{
                                contestId:1
                            }
                        }

Code:

if (notification.userData == null)
    {
      Debug.Log("EMPTY!");
    }
    else
    {
      Debug.Log("NOT EMPTY?");

      foreach (KeyValuePair<string, string> it in notification.userData)
      {
        Debug.Log("yes");
        Debug.Log(it.Key + ":" + it.Value);
      }
    }
matthewwwillard commented 5 years ago

Bumping this, still having issues.

yuriy-universal-ivanov commented 5 years ago

Hi @matthewwwillard ,

Your APNS payload format is simply wrong. Please see https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html, i.e. please put your payload outside the "data" node, it should be directly in the root node. Besides, UTNotifications only work with string user data, so make sure it's string in the json you're sending.

Best regards, Yuriy, Universal Tools team.

matthewwwillard commented 5 years ago

@yuriy-universal-ivanov Thanks!