I'm trying to implement silent Push Notifications on an iOS application and I have followed the Urban Airship Getting Started for iOS but there's not a single sample application that portraits how to implement silent push notifications that can be captured on the UAPushNotificationDelegate. I have created a test application and it's working just fine. I'm currently getting simple Push Notifications.
I have been using their Push API endpoints through CURLs command and they work perfectly.
My goal is to understand a couple of things:
({"aps":{"content-available" : 1}})
func receivedBackgroundNotification(_ notificationContent: UANotificationContent, completionHandler: @escaping (UIBackgroundFetchResult) -> Swift.Void)
I would to be able to implement silent push notifications on my application and I would like to have the community help to do so. Here's a reference Apple documentation on the matter: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_updates_to_your_app_silently
And here are some questions from other UA customers with the same concern: https://support.urbanairship.com/hc/en-us/community/posts/115011296606-Differentiate-silent-notifications-from-normal-push-notification https://support.urbanairship.com/hc/en-us/community/posts/360010098392-Custom-actions-while-app-in-background https://support.urbanairship.com/hc/en-us/community/posts/360000003566-Background-notifications-working-on-some-devices-but-not-on-others
答案 0 :(得分:0)
1)已回答here
2)自定义操作:
let customAction : UAAction = UAAction(block: {(args, completionHanlder) in
// Do something with args
completionHanlder(UAActionResult.empty())
})
3)注册动作:
UAirship.shared().actionRegistry.register(customAction, name: "custom_action_name")
4)实现委托并重写方法。如果要运行自定义操作,则需要在有效负载中将其定义为app_defined
操作。