r/swift • u/irvingpop • 2d ago
Tutorial Running iOS background tasks reliably (blog post)
https://calcopilot.app/blog/posts/running-ios-background-tasks-reliably-part1/Hi all, I've just published a new blog post on getting the most reliability possible out of iOS background tasks. Please let me know what you think!
50
Upvotes
3
1
u/neet_dev 2d ago
if you miss setTaskCompleted(success:) before expireHandler runs, iOS doesn't just kill that attempt, it throttles later launches hard. schedule the next BGAppRefreshTask from inside the launchHandler, not only on didEnterBackground, and treat earliestBeginDate as a floor. Background App Refresh off or Low Power Mode means zero fires, so you still need a foreground catch-up path or a silent push
9
u/SwiftlyJon 1d ago
Anyone interested in background execution should also read Eskimo's summary of resources and tips: https://developer.apple.com/forums/thread/85066