Bug 7291 - Activity Indicator not working
Summary: Activity Indicator not working
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.4.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-09-19 07:09 UTC by Amanda
Modified: 2012-09-19 17:22 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Amanda 2012-09-19 07:09:15 UTC

My button event fires code to upload stuff to Facebook. I used to have my Activity Indicator show during this upload by invoking it on a new thread. I then upgraded to Monotouch 5.4.1. Now I cant do that because of the new "UIKitThreadAccessException exception if you try to invoke a UIKit method from a background thread."  Please can you help me with this? Simply putting myActivityIndicator.StartAnimating() does not work, no indicator shows. It does, however, work for other tasks when called from my ViewDidLoad, for instance.


Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-09-19 07:20:23 UTC
You need to show the Activity Indicator on the main thread (use BeginInvokeOnMainThread to execute code asynchronously on the main thread).
Comment 2 Amanda 2012-09-19 07:29:07 UTC
Thanks Rolf

However, I tried that already. I called BeginInvokeOnMainThread(delegate{myActivityIndicator.StartAnimating();}); from within my button Click event and it still does not show.


Comment 3 Amanda 2012-09-19 07:45:56 UTC
My Apologies, Rolf, I made a mistake:

It doesn't show when calling InvokeOnMainThread(...). When I call BeginInvokeOnMainThread it shows when the processing is done, after the event code has been processed.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2012-09-19 08:38:18 UTC
OK, I'll close this then :)
Comment 5 Amanda 2012-09-19 08:44:59 UTC

Do you know of a way to make the indicator start animating as the event code is being processed, and not after, as is the case when I call BeginInvokeOnMainThread, as it used to do when I call invoke the activityIndicator from a new thread?

Appreciate your help

Comment 6 Rolf Bjarne Kvinge [MSFT] 2012-09-19 08:48:44 UTC

You need to do the event processing on a separate thread to accomplish that.
Comment 7 Amanda 2012-09-19 08:52:42 UTC
Thanks Rolf
Comment 8 Rolf Bjarne Kvinge [MSFT] 2012-09-19 17:22:10 UTC
Closing again then :)

Please reopen if you still have issues.