它在使用 xib、Xamarin 中添加的 MKMapview 变量时崩溃

Its crashing while using the MKMapview variable which is added in xib ,Xamarin

我在 xamarin ios 项目的故事板上添加了一个 MKMapview,当我尝试使用该地图视图的引用(对象)时它崩溃了

正在抛出 Null 异常

以下是我的class.desingerclass自动生成的代码

using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;

namespace Running2Win.iOS
{
    [Register ("MapViewController")]
    partial class MapViewController
    {
        [Outlet]
        [GeneratedCode ("iOS Designer", "1.0")]
        MapKit.MKMapView objMapView { get; set; }

        void ReleaseDesignerOutlets ()
        {
            if (objMapView != null) {
                objMapView.Dispose ();
                objMapView = null;
            }
        }
    }
}

我正在尝试在 class 的 viewdidload 方法中访问该地图对象,如下所示

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
objMapView.MapType = MKMapType.Standard; (Its crashing at this line by through Null exception for the objMapView variable)

}

我已删除 class 并重新创建,但仍然存在此崩溃,

任何帮助将不胜感激,在此先感谢

我已经通过删除并重新创建 class

解决了这个问题