C# 简单Segue不在Xamarin工作

C# 简单Segue不在Xamarin工作,c#,ios,xamarin,xamarin.ios,xamarin-studio,C#,Ios,Xamarin,Xamarin.ios,Xamarin Studio,我正在使用xamarin studio在我的应用程序中尝试一个简单的segue。我使用故事板使用“present modally”功能启动segue,但每次单击按钮在模拟器中执行segue时,我都会收到以下错误: 未能封送Objective-C对象0x7f8018511770(类型:loginViewController)。找不到此对象的现有托管实例,也无法创建新的托管实例(因为类型“iOSApp.loginViewController”没有接受一个IntPtr参数的构造函数) 你知道是什么导致

我正在使用xamarin studio在我的应用程序中尝试一个简单的segue。我使用故事板使用“present modally”功能启动segue,但每次单击按钮在模拟器中执行segue时,我都会收到以下错误:

未能封送Objective-C对象0x7f8018511770(类型:loginViewController)。找不到此对象的现有托管实例,也无法创建新的托管实例(因为类型“iOSApp.loginViewController”没有接受一个IntPtr参数的构造函数)

你知道是什么导致了这个问题吗?我还附上了我的main.storyboard文件的屏幕截图

以下代码段是我的
ViewController.cs
文件和
loginViewController.cs
代码

using System;

using UIKit;

namespace iOSApp
{
    public partial class ViewController : UIViewController
    {
        protected ViewController(IntPtr handle) : base(handle)
        {
            // Note: this .ctor should not contain any initialization logic.
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
        }

        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            // Release any cached data, images, etc that aren't in use.
        }
     }
}


LoginViewController
类中,确保您具有以下构造函数,以便可以从情节提要中对其进行膨胀:

protected YourClassNameViewController(IntPtr handle) : base(handle)
{
    // Note: this .ctor should not contain any initialization logic.
}
如果您的类名为
loginViewController
,则您的类将类似于:

protected partial class loginViewController : UIViewController
{
    public loginViewController(IntPtr handle) : base (handle)
    {
       // Note: this .ctor should not contain any initialization logic.
    }

    ~~~~ rest of class
}

仍然会导致相同的错误,我将编辑问题以包括
ViewController.cs
loginViewController.cs
您的
loginViewController
的屏幕截图。actor调用了错误的基址,将其更改为与我回答中的基址相匹配,以后请不要添加代码的屏幕截图,将代码添加为文本。它是可搜索的,很容易被其他人查看,截图不是…;-)更改了问题以反映建议和代码(如上所示),但是,在模拟器中运行时,相同的问题和相同的错误代码现在应该可以工作了,请确保您执行了清理并重新生成所有,从模拟器或设备中删除旧应用程序也只是为了确保您正在运行新应用程序。清理成功,谢谢先生。
protected partial class loginViewController : UIViewController
{
    public loginViewController(IntPtr handle) : base (handle)
    {
       // Note: this .ctor should not contain any initialization logic.
    }

    ~~~~ rest of class
}