Monotouch app中的随机崩溃

时间:2012-08-13 14:56:56

标签: crash xamarin.ios

我在Monotouch iOS应用程序中遇到随机崩溃。使用该应用程序一段时间后会发生崩溃。它们通常在锁定和解锁设备后发生。这次崩溃中有两个堆栈跟踪,这个:

0 ogaza 0x00003382 + 0
1 ogaza 0x00003fac + 0
2 libsystem_c.dylib 0x327e17ec _sigtramp + 48
3 libsystem_c.dylib 0x327d720e pthread_kill + 54
4 libsystem_c.dylib 0x327d029e abort + 94
5 ogaza 0x00684666 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6626814
6 ogaza 0x005dc0ee _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5937286
7 ogaza 0x005dc3b6 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5937998
8 ogaza 0x006501a0 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6412600
9 ogaza 0x00650f16 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6416046
10 ogaza 0x00650fd8 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6416240
11 ogaza 0x005e8244 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5986780
12 ogaza 0x005e83f0 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5987208
13 ogaza 0x005e70c2 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5982298
14 ogaza 0x002ffd87 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 2938143
15 ogaza 0x004579eb _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4346243
16 ogaza 0x00457d0b _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4347043
17 ogaza 0x00458e73 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4351499
18 ogaza 0x00457c17 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4346799
19 ogaza 0x004577bb _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4345683
20 ogaza 0x00415ed3 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4077163
21 ogaza 0x00415abf _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4076119
22 ogaza 0x004807db _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4513651
23 ogaza 0x004801eb _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4512131
24 ogaza 0x0046db27 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4436671
25 ogaza 0x003fdc7b _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 3978259
26 ogaza 0x003ffacb _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 3986019
27 ogaza 0x0004d2a3 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 109115
28 ogaza 0x002aa467 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 2587647
29 ogaza 0x005d4172 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5904650
30 ogaza 0x0064f996 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6410542
31 ogaza 0x005bf8d6 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5820526
32 CoreFoundation 0x3532f3fc -[NSObject performSelector:withObject:withObject:] + 52
33 UIKit 0x32e24e06 -[UIApplication sendAction:to:from:forEvent:] + 62
34 UIKit 0x32e24dc2 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
35 UIKit 0x32e24da0 -[UIControl sendAction:to:forEvent:] + 44
36 UIKit 0x32e24b10 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 492
37 UIKit 0x32e25448 -[UIControl touchesEnded:withEvent:] + 476
38 UIKit 0x32e17b86 _UIGestureRecognizerUpdate + 5222
39 CoreFoundation 0x353a9b1a __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
40 CoreFoundation 0x353a7d56 __CFRunLoopDoObservers + 258
41 CoreFoundation 0x353a80b0 __CFRunLoopRun + 760
42 CoreFoundation 0x3532b4a4 CFRunLoopRunSpecific + 300
43 CoreFoundation 0x3532b36c CFRunLoopRunInMode + 104
44 GraphicsServices 0x36fc7438 GSEventRunModal + 136
45 UIKit 0x32e37cd4 UIApplicationMain + 1080
46 ogaza 0x000712b3 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 256587
47 ogaza 0x003d7777 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 3821327
48 ogaza 0x002aa467 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 2587647
49 ogaza 0x005d4172 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5904650
50 ogaza 0x0064f996 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6410542
51 ogaza 0x006526ae _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6422086
52 ogaza 0x00655fda _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6436722
53 ogaza 0x005d8bce _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5923686
54 ogaza 0x00695697 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6696495
55 ogaza 0x00032bfb _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 915

而且:

0 ogaza 0x00003382 + 0
1 ogaza 0x00003fac + 0
2 libsystem_c.dylib 0x327e17ec _sigtramp + 48
3 ogaza 0x00053b8f _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 135975
4 ogaza 0x0047abff _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4490135
5 ogaza 0x00406cdb _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 4015219
6 ogaza 0x002aa467 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 2587647
7 ogaza 0x005d4172 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5904650
8 ogaza 0x0064f996 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6410542
9 ogaza 0x005cc522 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5872826
10 UIKit 0x32e4bb94 -[UIViewController _setViewAppearState:isAnimating:] + 144
11 UIKit 0x32ea5d84 -[UIViewController _endAppearanceTransition:] + 264
12 UIKit 0x32e68250 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 680
13 UIKit 0x32e67fa0 -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] + 292
14 UIKit 0x32e67cba -[UINavigationTransitionView _cleanupTransition] + 650
15 UIKit 0x32e67a2e -[UINavigationTransitionView _navigationTransitionDidStop] + 62
16 UIKit 0x32e1eaaa -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 470
17 UIKit 0x32e243d4 -[UIViewAnimationState animationDidStop:finished:] + 52
18 QuartzCore 0x3222ac2e _ZN2CA5Layer23run_animation_callbacksEPv + 202
19 libdispatch.dylib 0x34264ee6 _dispatch_main_queue_callback_4CF$VARIANT$mp + 194
20 CoreFoundation 0x353a82ac __CFRunLoopRun + 1268
21 CoreFoundation 0x3532b4a4 CFRunLoopRunSpecific + 300
22 CoreFoundation 0x3532b36c CFRunLoopRunInMode + 104
23 GraphicsServices 0x36fc7438 GSEventRunModal + 136
24 UIKit 0x32e37cd4 UIApplicationMain + 1080
25 ogaza 0x000712b3 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 256587
26 ogaza 0x003d7777 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 3821327
27 ogaza 0x002aa467 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 2587647
28 ogaza 0x005d4172 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5904650
29 ogaza 0x0064f996 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6410542
30 ogaza 0x006526ae _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6422086
31 ogaza 0x00655fda _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6436722
32 ogaza 0x005d8bce _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 5923686
33 ogaza 0x00695697 _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 6696495
34 ogaza 0x00032bfb _ZNSt6vectorIhSaIhEEC2IPKhEET_S5_RKS0_ + 915

我怀疑内存管理存在一些问题。我尝试了几个来自互联网的提示,如:

  • 当使用从UITableViewCell继承的类时,将它们保存在我的viewcontroller中的数组中。
  • 保存我在类字段中附加事件的所有控件。
  • 将SGen GC与引用计数扩展名一起使用

这些都不起作用。

我可以做些什么来调试这个?

2 个答案:

答案 0 :(得分:1)

1.在设备上尝试调试,这里是how to

2.尝试在入口点添加try catch

public class Application
{
    private static void Main(string[] args)
    {
        try
        {
            UIApplication.Main(args, null, "AppDelegate");
        }
        catch (Exception ex)
        {
            Logger.Error(ex);
        }
    }

3.尝试订阅UnhandledException

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
        .....
    }

    private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        Logger.Error(e.ExceptionObject);
    }

4.查看Monotouch limitations

答案 1 :(得分:0)

我能够解决这个问题。问题的根源是TestFlight崩溃报告,这使得Monotouch调试行为异常。在调试版本中删除TestFlight后,我从Mono获得了一个正确的错误报告:

http://docs.xamarin.com/ios/troubleshooting#Ran_out_of_trampolines_of_type_2

相关问题