NullReference Exception presenting ViewController that has storyboard outlets?

has.91has.91 JOMember
edited June 2016 in Xamarin.iOS

I'm using Xamarin Studio and I'm create a StoryBoard inside this I've create a NavigationController

in the Root View Controller I've add 2 controls first is Search Bar and Table View each of them are assigned whit specific name in Identity properties after CTRL+ drag from it to the ViewController I got

[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UISearchBar edittext { get; set; }

[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITableView listView { get; set; }

in ViewController.desgin.cs and I can access them in my code normally

Now I've create other ViewController and add 2 labels UILabel but after doing previous steps I got an NullReferenceException when I'm try to using this control.

Tagged:

Answers

  • JoelHolmbergJoelHolmberg SEMember
    edited June 2016

    I'm having similar issues. When creating new graphical items using the xamarin storyboard view I get this in my designer.cs file:

    [Outlet]
    [GeneratedCode ("iOS Designer", "1.0")]
    code_goes_here
    

    but my old items look like this:

    [Outlet]
    code_goes_here
    

    and when running this in iOS simulators I get NullPointerException when using these new items. The old ones work good tho. Also, running on a device shows no problems at all, only in simulators.

    Might be related to your question so I'm interested in any response here.

Sign In or Register to comment.