I\'m building a iPhone application which depends data from an online database.
To update the data in the app i could check at a certain time interval if an update is ne
Yes, it is possible with iOS 7+
You can receive "background" push notifications if you override this method of UIApplicationDelegate: application(_:didReceiveRemoteNotification:fetchCompletionHandler:)
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void)
{
// do what you need i.e. download fresh content (max. 30 seconds)
completionHandler(UIBackgroundFetchResult.NoData)
}
As documentation of this method method says:
Use this method to process incoming remote notifications for your app. Unlike the application:didReceiveRemoteNotification: method, which is called only when your app is running in the foreground, the system calls this method when your app is running in the foreground or background. In addition, if you enabled the remote notifications background mode, the system launches your app (or wakes it from the suspended state) and puts it in the background state when a remote notification arrives.
Don't forget to enable "Background fetch" and "Remote notifications" in your background modes.
More info about background execution here.