RE: Delaying Between applicationWillResignActive andapplicationDidEnterBackground
RE: Delaying Between applicationWillResignActive andapplicationDidEnterBackground
- Subject: RE: Delaying Between applicationWillResignActive andapplicationDidEnterBackground
- From: Julius Oklamcak <email@hidden>
- Date: Wed, 21 Mar 2012 13:19:52 -0400
Have you looked into using UIApplication's
-beginBackgroundTaskWithExpirationHandler: in the UIApplicationDelegate's
-applicationDidEnterBackground: to give you some background run time to
finish the loop?
> My biggest problem is this: My game runs in a tight loop. When I get
applicationWillResignActive (after the home button is pushed), I immediately
put up a flag to stop the loop BUT the loop could be in ANY place. In
physics, in rendering, etc. What I need to do is let the loop complete
another complete revolution so it finishes everything it needs to do and
then get held up at the flag that halts it. Without this, I can't save, and
the restart will happen at a random place.
>
> The problem is applicationDidEnterBackground gets called immediately
without any more time given to my application. I can't save state because
state might be in a strange place!
>
> The easy solution is to block between the callbacks. This blocking will
be in the milliseconds. But my application gets no additional time between
the two calls (as far as I can tell, it's hard to debug these calls.)
>
> Another good solution would be someway that when I get into
applicationDidEnterBackground I can tell it to recall me and then return.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden