I've implemented an update button like this:

- (IBAction)updateButton:(id)sender
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
   [downloadIndicator startAnimating];

   [[DataManager sharedDataManager] updateDataFiles];

   [downloadIndicator stopAnimating];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

And in the DataManager class I have this:

- (void)updateDataFiles
{
   NSString *dataString = [NSString stringWithContentsOfURL:url
      encoding:NSASCIIStringEncoding
      error:NULL];
}

I have the downloadIndicator connected up using IB, and I'm pretty sure the wiring is OK. But when the button is clicked, I see an activity indicator spinning in the status bar, but I don't see the one I implemented myself using IB.

I know it's got something to do with my updateDataFiles method not being asynchronous, but beyond that I'm at a loss. I'd really rather avoid writing the extra code to do the download using NSURLConnection mechanisms: the user can't do anything until the download finishes anyway.

I'd like to have an alert panel or the second activity indicator visible during the download. Can someone point me towards a simple solution?

dkj

PS: I've started reading the "Concurrency Programming Guide", but that's going to take awhile. And for all I know at present, the solution for this particular problem may not be in there.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to