2013-02-10 171 views
0

在我基於Monotouch的iOS項目中,我有2個視圖控制器。在第一個ViewController中,我通過xib創建了一個按鈕。 現在選擇這個按鈕,我想顯示第二個視圖控制器,但它沒有發生,並導致應用程序崩潰。在Monotouch中以模態方式顯示視圖控制器

所以在我design.cs文件,這是創建按鈕

[Outlet] 
MonoTouch.UIKit.UIButton firstButton { get; set; } 

[Action ("clickMe:")] 
partial void clickMe (MonoTouch.Foundation.NSObject sender); 

這是在cs文件我的按鈕操作方法,這是造成飛機墜毀的方式。

partial void clickMe (MonoTouch.Foundation.NSObject sender) 

{ 

SecondViewController secondViewControllerObject=new SecondViewController(); 

this.PresentViewController(secondViewControllerObject, true, null); 

} 

錯誤說明: -

得到了SIGABRT在執行本機代碼。

終止運行時,由於未處理的異常

Unhandled Exception: 
0 TestingFirstProject     0x0008ebce mono_handle_exception_internal_first_pass + 2190 
1 TestingFirstProject     0x00090612 mono_handle_exception_internal + 1602 
2 TestingFirstProject     0x0009115f mono_handle_exception + 47 
3 TestingFirstProject     0x000d42b2 mono_x86_throw_exception + 306 
4 ???         0x0b496f8f 0x0 + 189362063 
5 TestingFirstProject     0x00215f38 monotouch_exception_handler + 136 
6 CoreFoundation      0x013ca318 __handleUncaughtException + 728 
7 libobjc.A.dylib      0x0401d0b9 _ZL15_objc_terminatev + 86 
8 libc++abi.dylib      0x0435ea65 _ZL19safe_handler_callerPFvvE + 13 
9 libc++abi.dylib      0x0435eacd __cxa_bad_typeid + 0 
10 libc++abi.dylib      0x0435fbc2 _ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception + 0 
11 libobjc.A.dylib      0x0401cf89 _ZL26_objc_exception_destructorPv + 0 
12 CoreFoundation      0x013c9fb1 -[NSException raise] + 17 
13 Foundation       0x01a08711 -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282 
14 Foundation       0x01989ec8 _NSSetUsingKeyValueSetter + 140 
15 Foundation       0x019899b7 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267 
16 Foundation       0x019b4428 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412 
17 UIKit        0x029410cc -[UIRuntimeOutletConnection connect] + 106 
18 libobjc.A.dylib      0x04030663 -[NSObject performSelector:] + 62 
19 CoreFoundation      0x0133c45a -[NSArray makeObjectsPerformSelector:] + 314 
20 UIKit        0x0293fbcf -[UINib instantiateWithOwner:options:] + 1327 
21 UIKit        0x02804e37 -[UIViewController _loadViewFromNibNamed:bundle:] + 280 
22 UIKit        0x02805418 -[UIViewController loadView] + 302 
23 UIKit        0x02805648 -[UIViewController loadViewIfRequired] + 73 
24 UIKit        0x02805882 -[UIViewController view] + 33 
25 UIKit        0x02811235 -[UIViewController shouldAutorotate] + 36 
26 UIKit        0x02a103d2 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1933 
27 UIKit        0x0280e4f3 -[UIViewController presentViewController:withTransition:completion:] + 4521 
28 UIKit        0x0280e777 -[UIViewController presentViewController:animated:completion:] + 112 
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr_bool_IntPtr (intptr,intptr,intptr,bool,intptr) <IL 0x00016, 0x00044> 
at MonoTouch.UIKit.UIViewController.PresentViewController (MonoTouch.UIKit.UIViewController,bool,MonoTouch.Foundation.NSAction) [0x0006f] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:659 
at TestingFirstProject.TestingFirstProjectViewController.clickMe (MonoTouch.Foundation.NSObject) [0x00006] in /Users/rock/Desktop/Sample Project/TestingFirstProject/TestingFirstProject/TestingFirstProjectViewController.cs:41 
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x0004b, 0x0007d> 
33 TestingFirstProject     0x00009922 mono_jit_runtime_invoke + 722 
34 TestingFirstProject     0x0016c4ae mono_runtime_invoke + 126 
35 TestingFirstProject     0x0020f086 monotouch_trampoline + 3686 
36 libobjc.A.dylib      0x04030705 -[NSObject performSelector:withObject:withObject:] + 77 
37 UIKit        0x02727920 -[UIApplication sendAction:to:from:forEvent:] + 96 
38 UIKit        0x027278b8 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61 
39 UIKit        0x027e8671 -[UIControl sendAction:to:forEvent:] + 66 
40 UIKit        0x027e8bcf -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578 
41 UIKit        0x027e7d38 -[UIControl touchesEnded:withEvent:] + 546 
42 UIKit        0x0275733f -[UIWindow _sendTouchesForEvent:] + 846 
43 UIKit        0x02757552 -[UIWindow sendEvent:] + 273 
44 UIKit        0x027353aa -[UIApplication sendEvent:] + 436 
45 UIKit        0x02726cf8 _UIApplicationHandleEvent + 9874 
46 GraphicsServices     0x04d0fdf9 _PurpleEventCallback + 339 
47 GraphicsServices     0x04d0fad0 PurpleEventCallback + 46 
48 CoreFoundation      0x012b6bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53 
49 CoreFoundation      0x012b6962 __CFRunLoopDoSource1 + 146 
50 CoreFoundation      0x012e7bb6 __CFRunLoopRun + 2118 
51 CoreFoundation      0x012e6f44 CFRunLoopRunSpecific + 276 
52 CoreFoundation      0x012e6e1b CFRunLoopRunInMode + 123 
53 GraphicsServices     0x04d0e7e3 GSEventRunModal + 88 
54 GraphicsServices     0x04d0e668 GSEventRun + 104 
55 UIKit        0x0272465c UIApplicationMain + 1211 
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x00056, 0x000a4> 
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
at TestingFirstProject.Application.Main (string[]) [0x00000] in /Users/rock/Desktop/Sample Project/TestingFirstProject/TestingFirstProject/Main.cs:17 
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00049, 0x00077> 
60 TestingFirstProject     0x00009922 mono_jit_runtime_invoke + 722 
61 TestingFirstProject     0x0016c4ae mono_runtime_invoke + 126 
62 TestingFirstProject     0x001706a4 mono_runtime_exec_main + 420 
63 TestingFirstProject     0x00175a95 mono_runtime_run_main + 725 
64 TestingFirstProject     0x00066e05 mono_jit_exec + 149 
65 TestingFirstProject     0x0020433d main + 2013 
66 TestingFirstProject     0x00002955 start + 53 

[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSUnknownKeyException Reason: [<SecondViewController 0x12a36ca0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key butnSubmit. 
    at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool_IntPtr (intptr,intptr,intptr,bool,intptr) 
    at MonoTouch.UIKit.UIViewController.PresentViewController (MonoTouch.UIKit.UIViewController viewControllerToPresent, Boolean animated, MonoTouch.Foundation.NSAction completionHandler) [0x0006f] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:659 
    at TestingFirstProject.TestingFirstProjectViewController.clickMe (MonoTouch.Foundation.NSObject sender) [0x00006] in /Users/rock/Desktop/Sample Project/TestingFirstProject/TestingFirstProject/TestingFirstProjectViewController.cs:41 
    at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) 
    at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
    at TestingFirstProject.Application.Main (System.String[] args) [0x00000] in /Users/rock/Desktop/Sample Project/TestingFirstProject/TestingFirstProject/Main.cs:17 
Stacktrace: 


Native stacktrace: 

    0 TestingFirstProject     0x0009148c mono_handle_native_sigsegv + 284 
    1 TestingFirstProject     0x000d769d sigabrt_signal_handler + 109 
    2 libsystem_c.dylib     0x9a4c386b _sigtramp + 43 
    3 ???         0xffffffff 0x0 + 4294967295 
    4 libsystem_sim_c.dylib    0x041e057b abort + 140 
    5 TestingFirstProject     0x001ea3fd monoeg_g_logv + 157 
    6 TestingFirstProject     0x001ea42b monoeg_assertion_message + 43 
    7 TestingFirstProject     0x00215e5f monotouch_unhandled_exception_handler + 159 
    8 TestingFirstProject     0x0008cefc mono_invoke_unhandled_exception_hook + 140 
    9 TestingFirstProject     0x0009100a mono_handle_exception_internal + 4154 
    10 TestingFirstProject     0x0009115f mono_handle_exception + 47 
    11 TestingFirstProject     0x000d42b2 mono_x86_throw_exception + 306 
    12 ???         0x0b496f8f 0x0 + 189362063 
    13 TestingFirstProject     0x00215f38 monotouch_exception_handler + 136 
    14 CoreFoundation      0x013ca318 __handleUncaughtException + 728 
    15 libobjc.A.dylib      0x0401d0b9 _ZL15_objc_terminatev + 86 
    16 libc++abi.dylib      0x0435ea65 _ZL19safe_handler_callerPFvvE + 13 
    17 libc++abi.dylib      0x0435eacd __cxa_bad_typeid + 0 
    18 libc++abi.dylib      0x0435fbc2 _ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception + 0 
    19 libobjc.A.dylib      0x0401cf89 _ZL26_objc_exception_destructorPv + 0 
    20 CoreFoundation      0x013c9fb1 -[NSException raise] + 17 
    21 Foundation       0x01a08711 -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282 
    22 Foundation       0x01989ec8 _NSSetUsingKeyValueSetter + 140 
    23 Foundation       0x019899b7 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267 
    24 Foundation       0x019b4428 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412 
    25 UIKit        0x029410cc -[UIRuntimeOutletConnection connect] + 106 
    26 libobjc.A.dylib      0x04030663 -[NSObject performSelector:] + 62 
    27 CoreFoundation      0x0133c45a -[NSArray makeObjectsPerformSelector:] + 314 
    28 UIKit        0x0293fbcf -[UINib instantiateWithOwner:options:] + 1327 
    29 UIKit        0x02804e37 -[UIViewController _loadViewFromNibNamed:bundle:] + 280 
    30 UIKit        0x02805418 -[UIViewController loadView] + 302 
    31 UIKit        0x02805648 -[UIViewController loadViewIfRequired] + 73 
    32 UIKit        0x02805882 -[UIViewController view] + 33 
    33 UIKit        0x02811235 -[UIViewController shouldAutorotate] + 36 
    34 UIKit        0x02a103d2 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1933 
    35 UIKit        0x0280e4f3 -[UIViewController presentViewController:withTransition:completion:] + 4521 
    36 UIKit        0x0280e777 -[UIViewController presentViewController:animated:completion:] + 112 
    37 ???         0x129333bc 0x0 + 311636924 
    38 ???         0x12933118 0x0 + 311636248 
    39 ???         0x12932ff5 0x0 + 311635957 
    40 ???         0x12931ff5 0x0 + 311631861 
    41 TestingFirstProject     0x00009922 mono_jit_runtime_invoke + 722 
    42 TestingFirstProject     0x0016c4ae mono_runtime_invoke + 126 
    43 TestingFirstProject     0x0020f086 monotouch_trampoline + 3686 
    44 libobjc.A.dylib      0x04030705 -[NSObject performSelector:withObject:withObject:] + 77 
    45 UIKit        0x02727920 -[UIApplication sendAction:to:from:forEvent:] + 96 
    46 UIKit        0x027278b8 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61 
    47 UIKit        0x027e8671 -[UIControl sendAction:to:forEvent:] + 66 
    48 UIKit        0x027e8bcf -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578 
    49 UIKit        0x027e7d38 -[UIControl touchesEnded:withEvent:] + 546 
    50 UIKit        0x0275733f -[UIWindow _sendTouchesForEvent:] + 846 
    51 UIKit        0x02757552 -[UIWindow sendEvent:] + 273 
    52 UIKit        0x027353aa -[UIApplication sendEvent:] + 436 
    53 UIKit        0x02726cf8 _UIApplicationHandleEvent + 9874 
    54 GraphicsServices     0x04d0fdf9 _PurpleEventCallback + 339 
    55 GraphicsServices     0x04d0fad0 PurpleEventCallback + 46 
    56 CoreFoundation      0x012b6bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53 
    57 CoreFoundation      0x012b6962 __CFRunLoopDoSource1 + 146 
    58 CoreFoundation      0x012e7bb6 __CFRunLoopRun + 2118 
    59 CoreFoundation      0x012e6f44 CFRunLoopRunSpecific + 276 
    60 CoreFoundation      0x012e6e1b CFRunLoopRunInMode + 123 
    61 GraphicsServices     0x04d0e7e3 GSEventRunModal + 88 
    62 GraphicsServices     0x04d0e668 GSEventRun + 104 
    63 UIKit        0x0272465c UIApplicationMain + 1211 
    64 ???         0x0e9ccd74 0x0 + 245157236 
    65 ???         0x0e9cb3e8 0x0 + 245150696 
    66 ???         0x0e9cabe8 0x0 + 245148648 
    67 ???         0x0e9cac77 0x0 + 245148791 
    68 TestingFirstProject     0x00009922 mono_jit_runtime_invoke + 722 
    69 TestingFirstProject     0x0016c4ae mono_runtime_invoke + 126 
    70 TestingFirstProject     0x001706a4 mono_runtime_exec_main + 420 
    71 TestingFirstProject     0x00175a95 mono_runtime_run_main + 725 
    72 TestingFirstProject     0x00066e05 mono_jit_exec + 149 
    73 TestingFirstProject     0x0020433d main + 2013 
    74 TestingFirstProject     0x00002955 start + 53 

================================================================= 
Got a SIGABRT while executing native code. This usually indicates 
a fatal error in the mono runtime or one of the native libraries 
used by your application. 
================================================================= 
+0

你可以分享第二個控制器的代碼,我想知道是否有需要看的東西。 – 2013-02-10 21:13:14

回答

1

的信息,在你的異常關鍵位是:

這個類不是鍵值編碼兼容的關鍵butnSubmit

這意味着你的C#類有一個屬性,它在.xib(界面生成器)文件中沒有相應的出口。

重新檢查/重新創建您的網點,並查看是否可以解決問題。

相關問題