views:

101

answers:

2

I've got an activity indicator set up to start spinning when a file is getting downloaded from the internet. The file is downloaded asynchronously, and it also makes a request to continue downloading should the user send the app into the background or start another app. However, upon resuming my app, the activity indicator is no longer spinning, even though I haven't stopped it in code.

I set up a flag to let me know whether the activity indicator should be spinning, and I thought I could detect when the app came to the foreground, test the flag, and start the activity indicator up again, but none of the logical methods appear to fire when I set them up. I've tried the following:

- (void)applicationDidBecomeActive:(UIApplication *)application
- (void)applicationWillEnterForeground:(UIApplication *)application
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- (void)applicationWillResignActive:(UIApplication *)application
- (void)applicationDidEnterBackground:(UIApplication *)application

As I said, none of these methods fire when when the user switches back to the app (or away from it, for that matter).

What am I doing wrong?

A: 

My guess is that your app is stuck in an infinite loop on the UI thread somewhere, never allowing the run loop to continue. This would explain both why those resume methods are never called and why the spinner is not animating.

Ed Marty
A: 

The problem eventually "went away" while I was working with the code; I never figured out what caused the problem. Ed, maybe you were right? I just don't know.

JoBu1324