Picker w/ iOS 8.1 crash with code 0x00

EZRobotEZRobot ✭✭CAMember ✭✭
edited December 2014 in Xamarin.Forms

My code is very simple - I am attempting to add a Picker() to the StackLayout. The app crashes immediately without any exception - so it took me a while to debug what was causing it to crash. After commenting the other 5 controls, I narrowed it down to the Picker. When the Picker is not added to the StackLayout, I do not experience the crash.

// Doesn't work

Picker picker = new Picker();
picker.HorizontalOptions = LayoutOptions.FillAndExpand;
Children.Add(picker);

// Does work

Picker picker = new Picker();
picker.HorizontalOptions = LayoutOptions.FillAndExpand;

// Children.Add(picker);

Thanks in advance, and happy new year to those overseas

Posts

  • EZRobotEZRobot ✭✭ CAMember ✭✭

    Ah, the problem is with Picker having an empty item list.. This works...

      Picker picker = new Picker();
    
      picker.Items.Add("bannaa");
    
      picker.HorizontalOptions = LayoutOptions.FillAndExpand;
    
      Children.Add(picker);
    

    However, that is not a solution for me - as I populate the items later from a webservice result. Does Xamarin have a bug control system that I can add this to?

  • JoeMankeJoeManke ✭✭✭✭✭ USMember ✭✭✭✭✭

    As a temporary fix, you could put in a temporary item until you get the real items from the webservice.

    Picker picker = new Picker();
    picker.Items.Add("Waiting for options from server.");
    Children.Add(picker);
    

    Then when you have the results:

    picker.Items.Clear();
    
    foreach(string item in results)
    {
        picker.Items.Add(item);
    }
    
  • EZRobotEZRobot ✭✭ CAMember ✭✭

    Thanks Joe :) Happy new year as well

Sign In or Register to comment.