2017-01-04 7 views
1

앱이 다운되면 디버그 콘솔에 스택 아래에 있습니다. 충돌을 일으킨 클래스 및 메소드 이름을 가져 오는 방법은 무엇입니까?

(
    0 CoreFoundation      0x000000010811434b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x0000000107b4821e objc_exception_throw + 48 
    2 CoreFoundation      0x000000010816cbdf -[__NSSingleObjectArrayI objectAtIndex:] + 111 
    3 FanPaas        0x0000000106fa48fa -[ViewController openCrash] + 90 
    4 UIKit        0x0000000109bd3b88 -[UIApplication sendAction:to:from:forEvent:] + 83 
    5 UIKit        0x0000000109d592b2 -[UIControl sendAction:to:forEvent:] + 67 
    6 UIKit        0x0000000109d595cb -[UIControl _sendActionsForEvents:withEvent:] + 444 
    7 UIKit        0x0000000109d584c7 -[UIControl touchesEnded:withEvent:] + 668 
    8 UIKit        0x0000000109c410d5 -[UIWindow _sendTouchesForEvent:] + 2747 
    9 UIKit        0x0000000109c427c3 -[UIWindow sendEvent:] + 4011 
    10 UIKit        0x0000000109befa33 -[UIApplication sendEvent:] + 371 
    11 UIKit        0x000000010a3e1b6d __dispatchPreprocessedEventFromEventQueue + 3248 
    12 UIKit        0x000000010a3da817 __handleEventQueue + 4879 
    13 CoreFoundation      0x00000001080b9311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    14 CoreFoundation      0x000000010809e59c __CFRunLoopDoSources0 + 556 
    15 CoreFoundation      0x000000010809da86 __CFRunLoopRun + 918 
    16 CoreFoundation      0x000000010809d494 CFRunLoopRunSpecific + 420 
    17 GraphicsServices     0x000000010f82ba6f GSEventRunModal + 161 
    18 UIKit        0x0000000109bd1f34 UIApplicationMain + 159 
    19 FanPaas        0x0000000106fdf66f main + 111 
    20 libdyld.dylib      0x000000010c65868d start + 1 
) 

은 그래서 NSSetUncaughtExceptionHandler(&HandleException)[NSThread callStackSymbols]을 사용하여 해당 스택 추적을 잡으려고 노력했다.
(
    0 FanPaas        0x000000010176f05e +[UncaughtExceptionHandler backtrace] + 46 
    1 FanPaas        0x000000010176fe92 HandleException + 98 
    2 CoreFoundation      0x00000001028f156c __handleUncaughtException + 732 
    3 libobjc.A.dylib      0x00000001022bc496 _ZL15_objc_terminatev + 94 
    4 libc++abi.dylib      0x0000000107382e69 _ZSt11__terminatePFvvE + 8 
    5 libc++abi.dylib      0x0000000107382af4 __cxa_rethrow + 99 
    6 libobjc.A.dylib      0x00000001022bc3b7 objc_exception_rethrow + 40 
    7 CoreFoundation      0x000000010281151b CFRunLoopRunSpecific + 555 
    8 GraphicsServices     0x000000010a6bfa6f GSEventRunModal + 161 
    9 UIKit        0x0000000104345f34 UIApplicationMain + 159 
    10 FanPaas        0x000000010175020f main + 111 
    11 libdyld.dylib      0x00000001074ec68d start + 1 
) 

사실 [ViewController openCrash]는 사고가 발생,하지만 난 callStackSymbols에 그렇게하지 않았다. 하지만 디버그 콘솔에 표시됩니다.

충돌을 일으킨 클래스 및 메소드 이름을 가져 오는 방법은 무엇입니까? 위에

+0

를? –

+0

내 대답을 확인할 수 있습니다. http://stackoverflow.com/questions/41456810/unable-to-find-code-where-crash-happens-in-xcode-crash-report/41457309?noredirect=1#comment70121065_41457309 –

+0

Dheeraj에게 감사드립니다. 당신의 대답에 따라, 나는 crashlytics와 같은 써드 파티 라이브러리에 대한 릴리스 빌드에 대한 충돌 보고서를 가져 가야합니다. 거기에 다른 방법으로 그것을 프로그래밍 방식으로 얻고 응용 프로그램에서 자신의 만든 파일 (. csv)에 쓸 수 있습니다.? –

답변

1

enter image description here

선택 브레이크 포인트 기호는 하단의 + 기호를 클릭 한 후는 것 충돌의 원인이 특정 라인에 당신을 리드 예외 브레이크 Point.So을 클릭합니다.

+0

디버깅하는 동안 충돌을 일으키는 라인을 지적 할 수는 있지만 스택 추적에서 해당 라인이나 메소드 이름이 필요합니다. –

+0

해당 줄로 리디렉션하면 메서드 이름도 얻을 수 있습니다. –

+0

실제로이 메소드 이름을 trace에 기록해야합니다. –

0

당신이 할 수 있습니다 : 당신이 모든 예외 브레이크 포인트를 추가 않았다

1. Enable exception breakpoint. 
2. Your breakpoint will stop on method which causing crash. 
3. Add try catch block in that method, in catch block you can print method name and exception.