If a method is Deprecated, does this mean it will not work in updated systems?
I was using setMinimumBackgroundFetchInterval for background fetch and I believe it stopped working for ios 13 and newer versions.
Do you think it is because it is deprecated or a bug?
When I use Simulate Background Fetch it works fine, but it does not fetch when I really use the app.
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let successCallback: (_ data: Double) -> Void = { (data) in
if data == nil {
// No new data
completionHandler(.noData)
} else {
// There is a new data set
self.bodyMassObserverQueryTriggered() // count todays steps and updates database
completionHandler(.newData)
}
}
getSteps(completion: successCallback) // count todays steps and updates database
}
and I have the following lines in applicationdidfinishwithoptions:
UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum)
UIApplication.shared.setMinimumBackgroundFetchInterval(5*60)
Do I need anything else?
EDIT: One thing i found is i needed to remove BGTaskSchedulerPermittedIdentifiers from Info.plist according to apple docs:
Adding a BGTaskSchedulerPermittedIdentifiers key to the Info.plist disables application(:performFetchWithCompletionHandler:) and setMinimumBackgroundFetchInterval(:) in iOS 13 and later.