Re: Out of process download support
Re: Out of process download support
- Subject: Re: Out of process download support
- From: Fritz Anderson <email@hidden>
- Date: Fri, 21 Feb 2014 12:34:51 -0600
It would be helpful to know whether your question is about OS X or iOS. Groveling for the app-delegate method gave me the answer, but we shouldn’t have to search.
On 20 Feb 2014, at 5:20 PM, Scott Hancher <email@hidden> wrote:
> However, if my app is quit, then I don't seem to get a call to application:handleEventsForBackgroundURLSession:completionHandler: within a relaunched instance of my app nor is the file I've requested to download actually downloaded. I'm quitting my app via exit(EXIT_SUCCESS), which I suspect isn't ideal, but there doesn't seem to be another mechanism for killing it. I have tried to manually swipe the application up to remove it from the list of running apps on double tapping home, but this doesn't work either.
I don’t know the details, but the fact that it’s called a “background operation” suggests that the operation depends on the application going (at least initially) into the background, not that it should crash itself. I think it’s reasonable for iOS to assume that an app entering the background (even if later evicted) is in a safe state to continue the task, but a crashed application has enough wrong with it that the processes it spawns should be killed, too.
And in iOS a call to exit() is a crash. Period. Always.
Why on earth do you think it’s so important to destroy the app process? There’s a reason there is no supported way to do it: The device is the user’s computer. Not yours. Applications go off-screen when the user says so. Not you. You are not permitted to snatch the state of the device out of the user’s hands. Because it isn’t your computer.
If you can’t proceed at all (and I bet you can in this case), put up an alert explaining the situation and advise the user to press the Home button. Don’t just abscond.
But I suspect your app is in a recoverable state when its download commences. Put up a dancing bear (progress/activity view or the like) until the task ends. This has the further advantage that you can offer a cancel button to put the user (gasp) in control.
— F
--
Xcode 5 Start to Finish: On sale late March/early April. Actually pretty good.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden