I know this is not the first version of this kind of question - but all information I found seems to be outdated or even wrong. So I decided to ask the question again.
Currently I'm using remote notifications to send notifications to my iOS device. Because I'd like to "awake" my application every hour (even if the app was force closed by the user) my idea was to use silent-push notifications.
Just sending Notifications is working quite well - even in the background or after force-closed by the user. But how to wake my application when it's force-closed to perform a background task by using silent-push-notifications?
func application( _ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let aps = userInfo["aps"] as! [String: AnyObject] { // remote information
completionHandler(.newData) // call completion handler
}
This is the raw of the notification:
send notification but doesn't perform background task (doesn't awake my app)
{
"aps" : {
"alert" : {
"title" : "..."
},
"content-available" : 1,
"information" : "abc"
}
}
also doesn't perform background task (doesn't wake my app)
{
"aps" : {
"content-available" : 1,
"information" : "abc"
}
}