/
Silent push for iOS
Silent push for iOS
XCode → Signing & Capabilities → Background modes
Depends what you want to achieve with silent push, turn on Background fetch or Background processing or both.
At AppDelegate file you need to add those two methods to handle silent push content.
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print("perform fetch completition")
Appoxee.shared()?.performFetch(completionHandler: nil, andNotifyCompletionWith: { (error, data) in
if (NSNumber.isKind(of: data as! AnyClass)) {
print(data ?? "no date");
completionHandler(.newData)
}
completionHandler(.noData)
})
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print(userInfo)
Appoxee.shared()?.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler, andNotifyCompletionWith: { (error, data) in
if ((error) != nil) {
completionHandler(.failed)
} else {
//// No need to pefrom any action, since Appoxee will call completionHandler() providing it a UIBackgroundFetchResult.
}
})
}
Related content
Disable and re-enable Push Notifications for Appoxee Standalone
Disable and re-enable Push Notifications for Appoxee Standalone
More like this
Disable and re enable Push Notifications
Disable and re enable Push Notifications
More like this
Request Notification at Best Time for Appoxee Standalone
Request Notification at Best Time for Appoxee Standalone
More like this
Becoming UNUserNotificationCenterDelegate for Appoxee Standalone
Becoming UNUserNotificationCenterDelegate for Appoxee Standalone
More like this
iOS Receive Push Payload Details
iOS Receive Push Payload Details
More like this
Becoming UNUserNotificationCenterDelegate Observer
Becoming UNUserNotificationCenterDelegate Observer
More like this