Rob Bonner
Rob Bonner

Reputation: 9424

UIActivityView and blocking

I have a section of code that uploads an image:

[activity startAnimating];
 [self uploadImage:img Session_id:appDelegate.sessionID PlaceID:place.placeID Comment:comment.text];
 [activity stopAnimating];

I am sure that activity is wired up correctly to a UIActivityViewIndicator, but it never shows. Inside the uploadImage function, I open a connection to the server and start the upload. Does anyone have an example or possible explanation as to why the activity view would not display?

Upvotes: 1

Views: 585

Answers (1)

Tom Irving
Tom Irving

Reputation: 10059

If you're doing the upload on the main thread, then it's blocked and the UI cannot be updated.

I would suggest running it on a background thread.

Upvotes: 2

Related Questions