I am attempting to implement App Refresh with the Background Tasks framework and I cannot get the app to wake. Obviously I can get it to wake with debug functions, but I cannot seem to have the app refresh occur normally.
At first I assumed I was doing something wrong, so I went and downloaded the Refreshing and Maintaining Your App Using Background Tasks sample code. I edited it to OSLog every step of the way and ran that on two separate devices for over a day. One device is a test device for work, the other is my daily driver.
Upon inspecting the logs I'm not seeing any of my log messages indicating executions of the App Refresh Tasks, on either device.
Searching the logs with "com.example.apple-samplecode" provides a bunch of messages from dasd. It looks like when the app has first been loaded onto the phone it came up with a "Final Decision" of "Can Proceed" but then was immediately followed up with
Which seems like something made it decide it shouldn't run (based on "DecisionToRun:0").
Subsequent messages from dasd the decision always becomes "Must Not Proceed", with the vast majority of logs appearing like so
Occasionally there'll be extra policies, but vast majority of the time it's just the ApplicationPolicy.
There seems to be one of those log entries, from dasd, quite frequently with the most frequent being mere tens of milliseconds, all the way up to 4 minutes; though the most common time between evaluation does appear to be ~30 seconds.
With nearing an additional day of running the app on both devices I am seeing within about a 3 hour window another dozen "Can Proceed" messages immediately followed by "DecisionToRun:0", but there haven't been any more for the last 10 or so hours. Obviously also none of my log messages are there either.
Is there something, obvious or otherwise, that am I doing wrong here?
At first I assumed I was doing something wrong, so I went and downloaded the Refreshing and Maintaining Your App Using Background Tasks sample code. I edited it to OSLog every step of the way and ran that on two separate devices for over a day. One device is a test device for work, the other is my daily driver.
Upon inspecting the logs I'm not seeing any of my log messages indicating executions of the App Refresh Tasks, on either device.
Searching the logs with "com.example.apple-samplecode" provides a bunch of messages from dasd. It looks like when the app has first been loaded onto the phone it came up with a "Final Decision" of "Can Proceed" but then was immediately followed up with
Code Block plain com.apple.duetactivityscheduler default 2021-02-16 10:48:29.767009 +1100 dasd scoring 'bgRefresh-com.example.apple-samplecode.ColorFeed.refresh:5EE83C' CurrentScore: 0.617755, ThresholdScore: 0.772525 DecisionToRun:0
Which seems like something made it decide it shouldn't run (based on "DecisionToRun:0").
Subsequent messages from dasd the decision always becomes "Must Not Proceed", with the vast majority of logs appearing like so
Code Block plain com.apple.duetactivityscheduler default 2021-02-16 10:58:25.975816 +1100 dasd scoring bgRefresh-com.example.apple-samplecode.ColorFeed.refresh:5EE83C:[ {name: ApplicationPolicy, policyWeight: 50.000, response: {Decision: Must Not Proceed, Score: 0.00}} ], FinalDecision: Must Not Proceed}
Occasionally there'll be extra policies, but vast majority of the time it's just the ApplicationPolicy.
There seems to be one of those log entries, from dasd, quite frequently with the most frequent being mere tens of milliseconds, all the way up to 4 minutes; though the most common time between evaluation does appear to be ~30 seconds.
With nearing an additional day of running the app on both devices I am seeing within about a 3 hour window another dozen "Can Proceed" messages immediately followed by "DecisionToRun:0", but there haven't been any more for the last 10 or so hours. Obviously also none of my log messages are there either.
Is there something, obvious or otherwise, that am I doing wrong here?