Is there any system level background queue process

2019-02-24 02:54发布

问题:

I need to save a big file, sometime it takes a very long time to finish, user might just close the application. I am wondering whether the iPhone SDK could take over the unfinished big task.

Appears iPhone's own mail system could do background send. I prepared a email, click send, then close the mail app immediately. In home page, after several seconds, I heard a sound and the email was delivered.

回答1:

You're out of luck. Only Apple's own apps are allowed to operate in the background. But I think your app gets some time to finish up when the user closes the app.



回答2:

You can't run the app in the background as PEZ says. However you could spin off a thread to perform the task and then at least the user can get on with doing other things in your application.



回答3:

If I remember correctly, your app gets 5 seconds between the user pressing the home button and the iPhone OS killing it if you're not done.