I created a task where I create a local notification every 30 seconds and a notification when the expiration handle is fired. I can see that after receiving the advice for the limited time remaining, the notifications are generated without a limit, as if the app was never interrupted. Is it normal? Shouldn't it stop after about 30 seconds in case of app refresh?
How are you testing this? In the debugger? If so, be aware that the debugger prevents your app from being suspended, so it’s not the best way to test background code. Rather, it’s better to test this stuff with logging.
Way back in the day I wrote Testing Background Session Code to cover these subtleties. While its focus is on NSURLSession
code, a lot of the advice applies to all background code.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"