问题
Saw an app called PhoneRecover on the AppStore.
They advertise the following:
- PhoneRecover will automatically restart after a reboot on the iPhone 3GS and the iPhone 4 running iOS4.
How is this possible? What APIs are used to auto-launch an app after a boot?
回答1:
It's built into multi-tasking. "Backgrounded" apps are still in background after a reboot. Presumably the app does some work to re-instantiate itself and get its state going again the first time Core Location hits it in the background, but there's no other magic happening here. Any background-aware app will survive a reboot in a backgrounded state.
回答2:
I wouldn't count on this. I was running MotionX GPS and let the battery run completely dead. Upon restart MotionX was no longer running, broadcasting my position or tracking my position. The broadcast option is persistent too (survives app restart).
来源:https://stackoverflow.com/questions/5109305/iphone-app-can-autolaunch-after-device-boot