I am uploading a bunch of files from the iPhone to a web service. I want to have a UIAlertView on screen with a UIActivityIndicatorView inside. I got that to work fine. However, I want to update the title of the UIAlertView as each file gets uploaded. ("Uploading file 1...", "Uploading file 2...", etc.)
I know that you can't just set the title in a loop with synchronous web requests as the UI run loop will never get called. I tried using NSTimer to fire off the web requests but since each request duration is unpredictable, that doesn't work. (The message could update before the request is actually finished.)
I really want to upload each file synchronously, one at a time, as the iPhone bandwidth is pretty limited. I just can't figure out a mechanism to say 'once this synchronous operation finishes, let the UI update for a tick, then do another synchronous operation.'