swift - Previous watchOS background budget overload preventing current background app refreshes -
i'm developing watchos app executes regularly in background using background refresh tasks. while ago put in call update watch's complication @ each background refresh. burned through of complication updates and, believe, background budget app. assumed reset @ beginning of next day, doesn't seem case. since then, though i've removed complication refresh code altogether app not consistently execute background refreshes. i've deleted app , reinstalled , waited week executes these refreshes regularly when run through xcode (on device), not when run independently. ideas?
update:
func handle(_ backgroundtasks: set<wkrefreshbackgroundtask>) { backgroundtask in backgroundtasks { switch backgroundtask { case let connectivitytask wkwatchconnectivityrefreshbackgroundtask: connectivitytask.settaskcompleted() case let refreshtask wkapplicationrefreshbackgroundtask: maininterfacecontroller.scheduletask() refreshtask.settaskcompleted() case let snapshottask wksnapshotrefreshbackgroundtask: snapshottask.settaskcompleted() default: backgroundtask.settaskcompleted() } } dataprocessor.sharedinstance.dataprocessing() public static func scheduletask() { let firedate = date(timeintervalsincenow: 10.0) wkextension.shared().schedulebackgroundrefresh(withpreferreddate: firedate, userinfo: nil) { (error) in if (error == nil) { print("background task scheduled") } } } and task scheduled when application deactivates, kicking off chain. code working previously, confusing part.
Comments
Post a Comment