0

I am trying to display a UIAlertView with Xamarin.iOS (Monotouch). I am on the Main Thread and when running a Debug build it works fine.

However as soon as I switch to Release mode the Alert View will not show. Here is an example

var erroralert1 = new UIAlertView("Location", "Test", null, "Ok", null);
erroralert1.Show();

Do they not display in a Release build? Are UIAlertViews simple a Debug tool?

1 Answer 1

1

Despite the fact that UIAlertView is deprecated and should be replaced by UIAlertController it is not a debug tool. From what you show here the alert should be displayed. Do you call it inside an async method that? Maybe your code is not in the UI thread.

You can try to invoke it there with:

InvokeOnMainThread (() =>
{
    var erroralert1 = new UIAlertView("Location", "Test", null, "Ok", null);
    erroralert1.Show();
});
1
  • The code that is firing it is wrapping the call in a jump to the Main Thread. If it was on the wrong thread I would expect it to fail in Debug mode too but it doesn't Sep 24, 2015 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.