Hi,
I have a Swift application that plugs into Airship SDK 14 and its all working well (including the rich push notification pull back etc...) Its also implemented with a overriding UAPushNotificationDelegate (based on the one within the SWIFT Xcode example) so when it receives a background notification - it can prompt the user with an alert within the app controlled in the receivedNotificationResponse function.
I need to get the URL of the media attachment from the payload (I can see its within notificationContent.notificationInfo - based on the example again from the Swift sample) and I while I can step through the NSDictionary (Hashable: Any) to see the key / values = I cannot grab the URL is coming back. I cannot access it or pull it out of the payload to use it within the alert . I need to get the URL of the image attached to the push notification message under 'com.urbanairship.media_attachment' so I can display the image on the alert that is popping up to the user.
I cannot find any examples, code files etc... or any example within the swift code samples to help unfortuntely. (it really urgent now). I have tried writing my own function to read NotificationInfo but because the URL comes back in the payload in a non JSON / data format it cannot read it. I am seeing it come back as:
com.urbanairship.media_attachment {
url = ("https://abc.co.uk/image.jpg")
}
in summary - what is the best way (swift code example would really helpful within the receivedNotificationResponse function) in getting the URL of the media_attachment within the payload for SWIFT 5?
Comments
5 comments