2017-04-06 12 views
1

xamarin studioを使用して私のアプリで単純なセグを試しています。私は「現在モーダル」機能を使用してセグエを開始するためにストーリーボードを使用しますが、毎回私は、私は次のエラーが表示さシミュレータでセグエを実行するためのボタンをクリックします。Xamarinで動作しない単純なSegue

Failed to marshal the Objective-C object 0x7f8018511770 (type: loginViewController). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'iOSApp.loginViewController' does not have a constructor that takes one IntPtr argument).

あるかもしれないものに関してどのようなアイデア問題を引き起こしている? main.storyboardファイルのスクリーンショットも添付しました。

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クラスで

using System; 

using UIKit; 

namespace iOSApp 
{ 


    public partial class loginViewController : UIViewController 
    { 
     public loginViewController(IntPtr handle) : base(handle) 
     { 
     } 

     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. 
     } 


    } 
} 
+0

、私の答え – SushiHangover

+0

上のものと一致することを変更し、将来的にはコードの*スクリーンショット*を追加しないで、コードをテキストとして追加してください。それは検索可能で他の人が簡単に見直すことができますが、スクリーンショットはそうではありません;-) – SushiHangover

+0

同じエラーコード – bananibau5

答えて

1

それができるように、あなたは次のコンストラクタを持っていることを確認しますストーリーボードから膨らんだ:

protected YourClassNameViewController(IntPtr handle) : base(handle) 
{ 
    // Note: this .ctor should not contain any initialization logic. 
} 

あなたのクラス名がloginViewControllerであれば、あなたのクラスはになりますように:あなた `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 
} 
+0

でも同じエラーが発生するので、私は 'ViewController.cs'と' loginViewController.cs'のスクリーンショットを含むように質問を編集します – bananibau5

関連する問題