From the suspended state? Or from the terminated state? The former will require a resume while the latter will require a relaunch. Each presents its own unique challenges.
Getting the app suspended is quite easy: put it in the background and wait for a minute. As long as it doesn’t have any reason to stay running in the background, it’ll suspend promptly.
Getting an app into the terminated state is also easily, albeit a bit tedious. All you need to do is restart the device. Unless the app is tied some specific background features (like VoIP), it won’t be relaunched on restart.
IMPORTANT Do not terminate the app via the multitasking. In most cases the system will interpret that gesture as a request from the user to not allow the app to run in the background, and that’s state only gets cleared when the user manually launches the app.
In terms of forcing the app to be resumed (or relaunched) in the background, you have a bunch of options. Personally, I vacillate between:
Finally, a common problem with things failing when run in the background is data protection, both with keychain items and the files in the file system. You need to make sure the protection class on the items you access is compatible with your background execution strategy.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"