Xamarin.Forms Picker导致应用程序崩溃

时间:2014-06-30 01:08:17

标签: mono xamarin.ios xamarin xamarin.forms

我已设置以下代码。导航到视图时模拟器崩溃。我试图在我的应用程序中添加一个选择器,显示付费时间表,如每周,半年度和年度。

    insurancePicker = new Picker() 
    {
        Title = "Insurance Frequency",
        VerticalOptions = LayoutOptions.FillAndExpand
    };
    insurancePicker.Items.Add("Monthly");
    insurancePicker.Items.Add("Semi-Annual");
    insurancePicker.Items.Add("Annual");              
    insurancePicker.SelectedIndexChanged += (sender, args) =>
    {
        if (insurancePicker.SelectedIndex == -1)
        {               
        }
        else
        {
        }
    };

我将它添加到视图中:

Content = new StackLayout{
            Spacing = 20, Padding = new Thickness(10, 10, 10, 0),
            Children = {
                homeValue,
                amountOwed,
                new StackLayout{
                    Spacing = 2,
                    Orientation = StackOrientation.Horizontal, 
                    Children = {
                        insurance,
                        insurancePicker
                    }
                },
                new StackLayout{
                    Spacing = 2,
                    Orientation = StackOrientation.Horizontal, 
                    Children = {
                        taxes,
                        taxesPicker
                    }
                },
                btnCalculate
            }
        };

以下是我得到的堆栈跟踪:

  

mono-rt:Stacktrace:

     

mono-rt:at< 0xffffffff>

     

mono-rt:at(包装器托管到原生)   MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend_int_int_bool   (intptr,intptr,int,int,bool)

     

mono-rt:在MonoTouch.UIKit.UIPickerView.Select(int,int,bool)   [0x00010] in   /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIPickerView.g.cs:185

     

mono-rt:at Xamarin.Forms.Platform.iOS.PickerRenderer.UpdatePicker   ()

     

mono-rt:at Xamarin.Forms.Platform.iOS.PickerRenderer.OnModelSet   (Xamarin.Forms.VisualElement)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewRenderer.SetModel   (Xamarin.Forms.VisualElement)

     

mono-rt:at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer   (Xamarin.Forms.VisualElement)

     

mono-rt:在Xamarin.Forms.Platform.iOS.ViewPackager.HandleChildAdded   (Xamarin.Forms.VisualElement)

     

mono-rt:在Xamarin.Forms.EnumerableExtensions.ForEach   (System.Collections.Generic.IEnumerable 1<T>,System.Action 1)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewPackager.Load()

     

mono-rt:at   Xamarin.Forms.Platform.iOS.ViewRenderer.SetUpEventHandlers   (MonoTouch.UIKit.UIView)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewRenderer.OnModelSet   (Xamarin.Forms.VisualElement)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewRenderer.SetModel   (Xamarin.Forms.VisualElement)

     

mono-rt:at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer   (Xamarin.Forms.VisualElement)

     

mono-rt:在Xamarin.Forms.Platform.iOS.ViewPackager.HandleChildAdded   (Xamarin.Forms.VisualElement)

     

mono-rt:在Xamarin.Forms.EnumerableExtensions.ForEach   (System.Collections.Generic.IEnumerable 1<T>,System.Action 1)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewPackager.Load()

     

mono-rt:at   Xamarin.Forms.Platform.iOS.ViewRenderer.SetUpEventHandlers   (MonoTouch.UIKit.UIView)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewRenderer.OnModelSet   (Xamarin.Forms.VisualElement)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewRenderer.SetModel   (Xamarin.Forms.VisualElement)

     

mono-rt:at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer   (Xamarin.Forms.VisualElement)

     

mono-rt:在Xamarin.Forms.Platform.iOS.ViewPackager.HandleChildAdded   (Xamarin.Forms.VisualElement)

     

mono-rt:在Xamarin.Forms.EnumerableExtensions.ForEach   (System.Collections.Generic.IEnumerable 1<T>,System.Action 1)

     

mono-rt:at Xamarin.Forms.Platform.iOS.ViewPackager.Load()

     

mono-rt:at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad()   

     

mono-rt:at(wrapper runtime-invoke)   object.runtime_invoke_void__this__(object,intptr,intptr,intptr)

     

mono-rt:at&lt; 0xffffffff&gt;

     

mono-rt:at(包装器托管到原生)   MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper   (intptr,intptr)

     

mono-rt:at MonoTouch.UIKit.UIViewController.get_View()[0x00030]   在   /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIViewController.g.cs:2232

     

mono-rt:at   Xamarin.Forms.Platform.iOS.NavigationRenderer / d__d.MoveNext   ()

     

mono-rt:at   System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Startd__d&GT;   (Xamarin.Forms.Platform.iOS.NavigationRenderer / d__d&安培)   [0x0001b] in   /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/AsyncTaskMethodBuilder_T.cs:107

     

mono-rt:at   Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushAsync   (Xamarin.Forms.Page,bool)

     

mono-rt:at   Xamarin.Forms.Platform.iOS.NavigationRenderer.PushPageAsync   (Xamarin.Forms.Page,bool)

     

mono-rt:at   Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushRequested   (object,Xamarin.Forms.NavigationRequestedEventArgs)

     

mono-rt:在Xamarin.Forms.NavigationPage / d__c.MoveNext()   

     

mono-rt:at   System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Startd__c&GT;   (Xamarin.Forms.NavigationPage / d__c&amp;)[0x0001b] in   /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/AsyncTaskMethodBuilder.cs:107

     

mono-rt:在Xamarin.Forms.NavigationPage.PushAsync   (Xamarin.Forms.Page)

     

mono-rt:在Xamarin.Forms.NavigationPage / NavigationImpl.OnPushAsync   (Xamarin.Forms.Page)

     

mono-rt:在Xamarin.Forms.NavigationProxy.PushAsync   (Xamarin.Forms.Page)

     

mono-rt:在Xamarin.Forms.NavigationProxy.OnPushAsync   (Xamarin.Forms.Page)

     

mono-rt:在Xamarin.Forms.NavigationProxy.PushAsync   (Xamarin.Forms.Page)

     

mono-rt:在FNBMortgageForms.Shared.HomePage.m__1   (object,System.EventArgs)[0x00010] in   /Users/Projects/FNBMortgageForms/FNBMortgageForms/Views/HomePage.cs:59

     

mono-rt:在Xamarin.Forms.Button.SendClicked()

     

mono-rt:at   Xamarin.Forms.Platform.iOS.ButtonRenderer /&LT;&GT; c__DisplayClass1.b__0   (object,System.EventArgs)

     

mono-rt:at MonoTouch.UIKit.UIControlEventProxy.Activated()   [0x00007] in   /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:33

     

mono-rt:at(wrapper runtime-invoke)   object.runtime_invoke_void__this__(object,intptr,intptr,intptr)

     

mono-rt:at&lt; 0xffffffff&gt;

     

mono-rt:at(包装器托管到原生)   MonoTouch.UIKit.UIApplication.UIApplicationMain   (int,string [],intptr,intptr)

     

mono-rt:在MonoTouch.UIKit.UIApplication.Main   (string [],string,string)[0x0004c] in   /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38

     

mono-rt:at FNBMortgageForms.iOS.Application.Main(string [])   /Users/Projects/FNBMortgageForms/iOS/Main.cs:17中的[0x00008]

     

mono-rt:at(wrapper runtime-invoke)   .runtime_invoke_void_object(object,intptr,intptr,intptr)

     

mono-rt:原生堆栈跟踪:

     

单RT:

1 个答案:

答案 0 :(得分:1)

您正在填写insurancepicker的项目,但我看不到您填写taxespicker。错误报告不会为您提供该信息,但至少需要设置一个项目才能使Picker生效。