I am getting push notification and they are getting displayed on iPhone very nicely. But for some reason I want to parse the following result that I am receiving in didReceivedRemoteNotification method for push notification.
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print("FFTF", "didReceiveRemoteNotification", userInfo)
}
Following is what I get when I print the userInfo
[AnyHashable("FcmNotificationStatus"): 3, AnyHashable("ListItemIds"): ["42D890C4-0804-4434-B137-0EECDEFEC319"], AnyHashable("UserId"): 15, AnyHashable("gcm.message_id"): 1582109***6, AnyHashable("Title"): MY App, AnyHashable("body"): Welcome., AnyHashable("aps"): {
"content-available" = 1;
}, AnyHashable("google.c.sender.id"): 589****85]
This is response I am getting and from it I want to get the following fields that have specific types
- content-available (Int)
- FcmNotificationStatus (Int)
- ListItemIds (String Array)
- UserId (Int)
And I tried many things but I am getting my application crash. Is there anything that I can do to parse it easily? Please let me know how to do it.