Forum Xamarin Xamarin.iOS

ViewController not initializing after an upgrade to iOS9

Hello everyone.

I have a separate loadingview with a couple of progressbars that I've put on my Storyboard and it doesn't have any segues to/from it since I open it programmatically after user presses a button and several checks are made.

I use

Globals.LoadingView = (LoadingViewController)Storyboard.InstantiateViewController("loadingViewID");
Globals.LoadingView.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;

to initialize it, then

this.PresentViewController(Globals.LoadingView, true, () =>

in my main view controller to show it.

Previously, it worked just fine, but after an update all the LoadingViewController's UI elements (labels, buttons, progressbars) are null, and a null-reference exception is thrown when I try to update progress state (unsurprisingly).

Has anyone encountered something similar? Or maybe some ideas about why does this happen and how to fix it?


  • KMullinsKMullins USMember, Xamarin Team Xamurai
    edited September 2015

    Hi @IksanovAlbert,

    iOS 9 makes some modifications to how and when items get initialized so you might be hitting an issue where you are trying to access your UI elements before they have been constructed and wired-up. Please see the When to Initialize Views and View Controllers of our iOS 9 Troubleshooting docs for more information.



  • Thanks for your reply @KMullins !

    There is a link to a Bugzilla issue on a troubleshooting page, but I get an error "You are not authorized to access bug #32381". Can you make it public or at least give an access to me ([email protected])?

  • KMullinsKMullins USMember, Xamarin Team Xamurai

    The bug covers exactly what's in the post and shouldn't have been part of the doc. The gist is, find another place to init your objects... like the ViewDidLoad method.

  • Thanks! Got everything working by establishing all the links to my loadingView (in Globals and in BackgroundWorker) in the ViewDidLoad of the LoadingViewController. Otherwise they were linked to some non-existant instance of that view that wasn't properly initialized.

Sign In or Register to comment.