为什么在使用monotouch更新sqlite上的行时会出现异常?

时间:2012-03-15 11:59:19

标签: c# sqlite xamarin.ios

我有一个简单的表,当我尝试更新SQLite上的行时,应用程序关闭并公开此异常:

Stacktrace:

  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x000b7>
  at RemedioNaHora.Application.Main (string[]) <0x00017>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

    0   RemedioNaHora                       0x000908ec mono_handle_native_sigsegv + 284
    1   RemedioNaHora                       0x00005c88 mono_sigsegv_signal_handler + 248
    2   libsystem_c.dylib                   0x9365c59b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   UIKit                               0x0219355a -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
    5   UIKit                               0x02238b76 -[UIControl sendAction:to:forEvent:] + 66
    6   UIKit                               0x0223903f -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
    7   UIKit                               0x0238aa6c -[_UISwitchInternalView _sendActions] + 121
    8   Foundation                          0x0173786d __NSFireDelayedPerform + 389
    9   CoreFoundation                      0x01195966 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    10  CoreFoundation                      0x01195407 __CFRunLoopDoTimer + 551
    11  CoreFoundation                      0x010f87c0 __CFRunLoopRun + 1888
    12  CoreFoundation                      0x010f7db4 CFRunLoopRunSpecific + 212
    13  CoreFoundation                      0x010f7ccb CFRunLoopRunInMode + 123
    14  GraphicsServices                    0x04789879 GSEventRunModal + 207
    15  GraphicsServices                    0x0478993e GSEventRun + 114
    16  UIKit                               0x02190a9b UIApplicationMain + 1175
    17  ???                                 0x0b5b9784 0x0 + 190551940
    18  ???                                 0x0b5b89d0 0x0 + 190548432
    19  ???                                 0x0b5b8878 0x0 + 190548088
    20  ???                                 0x0b5b8907 0x0 + 190548231
    21  RemedioNaHora                       0x00009ff2 mono_jit_runtime_invoke + 722
    22  RemedioNaHora                       0x00169eee mono_runtime_invoke + 126
    23  RemedioNaHora                       0x0016dfd4 mono_runtime_exec_main + 420
    24  RemedioNaHora                       0x001733f5 mono_runtime_run_main + 725
    25  RemedioNaHora                       0x000671f5 mono_jit_exec + 149
    26  RemedioNaHora                       0x002116c9 main + 2825
    27  RemedioNaHora                       0x00003045 start + 53

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

有人知道发生了什么吗?

1 个答案:

答案 0 :(得分:0)

看起来UISwitch正在回调托管代码。这可能是:

  • 调用已被垃圾收集的对象(它已被释放,不能再使用)。确保您保留对正在使用的对象的引用将解决此问题;或

  • 它也可以从主线程中调用UI元素。确保UI元素仅用于主线程将解决这种情况。

希望这会对你有所帮助。如果没有,我们需要查看一些源代码,以便进一步帮助您。您可以编辑您的问题以添加它。