我有在代码中创建一个按钮(UIButton)并将其分配为子视图的代码......一切正常,除了我正在调试我的代码以记录异常,所以我创建了一个名为“创建异常”的按钮,该按钮处理程序执行真正简单的代码:
try
{
object Q = null;
Q.ToString();
}
catch
{
//Log.Exception ("Test", ex);
}
显然,除了获取空引用异常并捕获它之外,这不会做任何事情......并忽略它......
在模拟器中,一切都很好……在真实设备中?是的,应用程序退出时出现空引用异常!!怎么回事?
昨天更新的最新 Monotouch...
我担心我的所有异常都不会捕获并路由到 Log.Exeception() 代码...这是我首先要测试的...
这是在分配给按钮的触摸处理程序的匿名函数中。
-燧石
--- 更新,错误:
日期/时间:2013-03-25 22:26:59.269 -0500 操作系统版本:iPhone OS 5.1.1 (9B206) 报告版本:104
异常类型:EXC_CRASH (SIGSEGV) 异常代码:0x00000000、0x00000000 线程崩溃:1
线程 0 名称:调度队列:com.apple.main-thread 线程 0:0
TestApp 0x00b5a2d8 load_method (aot-runtime.c:2661) 1 TestApp 0x00b5ae86 mono_aot_get_method (aot-runtime.c:3097) 2 TestApp 0x00b346c0 mono_jit_compile_method_with_opt (mini. c:5089) 3 TestApp
0x00b34c3a mono_jit_runtime_invoke (mini.c:5639) 4 TestApp
0x00ba2b14 mono_runtime_invoke (object.c:2790) 5 TestApp
0x00ba136a mono_runtime_object_init (object.c:105) 6 TestApp 0x00bdfa30
mono_cexception:70_from.
0x00bdfd3e mono_get_exception_null_reference (exception.c:40) 8 TestApp 0x00b79944 mono_handle_exception_internal + 60 9 TestApp
0x00b7a22a mono_handle_exception (mini-exceptions.c:1894) 10 TestApp 0x00bab8f6 handle_signal_exception (exceptions-arm.c:559) 11 TestApp 0x00102794 MonoTouch_UIKit_UIControlEventProxy_Activated (UIControl.cs:30) 12 TestApp 0x009d9b14 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 192 13 TestApp 0x00b34f44 mono_jit_runtime_invoke (mini.c: 5793) 14 TestApp 0x00ba2b14 mono_runtime_invoke (object.c:2790) 15 TestApp
0x00b2b6f0 native_to_managed_trampoline_MonoTouch_UIKit_UIControlEventProxy_Activated (:88) 16 CoreFoundation 0x355763f6 -[NSObject performSelector:withObject:withObject:] + 46 17UIKit
0x3306be00 -[UIApplication sendAction:to:from:forEvent:] + 56 18 UIKit 0x3306bdbc -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24 19 UIKit
0x3306bd9a -[UIControl sendAction:to:forEvent:] + 38 20 UIKit
0x3306bb0a -[UIControl(内部) _sendActionsForEvents:withEvent:] + 486 21 UIKit 0x3306c442 -[UIControl touchesEnded:withEvent:] + 470 22 UIKit
0x3306a924 -[UIWindow _sendTouchesForEvent:] + 312 23 UIKit
0x3306a312 -[UI4 UIWindow sendEvent:] + 374
0x3305068e -[UIApplication sendEvent:] + 350 25 UIKit
0x3304ff34 _UIApplicationHandleEvent + 5820