...
What this means is there is no documented way for an application to sync data when an application is swiped closed. Therefore it is expected behavior that an application with our SDK enabled will not sync any data when the app is swiped closed. This would be true for any SDK framework running on iOS.
For HealthKit (Apple Health) specifically, the subscription observers need to be recreated immediately when the app is launched from a suspend or terminated state. To do this, you need to call [VLDHealthKitManager observeCurrentSubscriptions]
inside your application delegate’s application:didFinishLaunchingWithOptions:
function. Example:
Code Block |
---|
func application(_ application: UIApplication didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
VLDHealthKitManager.sharedInstance().observeCurrentSubscriptions()
return true
} |
Taking that action when the user launches the SDK enabled application after a forced quit state will ensure that you are syncing data continuously when the app is in the foreground or background.