我记得使用编译器(我认为JCreator或Eclipse)会告诉你它崩溃的代码行。我无法在XCode中找到此信息。它有这个功能吗?有没有办法看到程序在XCode中崩溃的行数?
编辑:
下面是一个示例堆扔在第一掷
2011-02-26 18:07:24.859 NumbersFlashCards[8803:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString size]: unrecognized selector sent to instance 0x531b580'
*调用堆栈:
(
0 CoreFoundation 0x00ebabe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0100f5c2 objc_exception_throw + 47
2 CoreFoundation 0x00ebc6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00e2c366 ___forwarding___ + 966
4 CoreFoundation 0x00e2bf22 _CF_forwarding_prep_0 + 50
5 UIKit 0x0039ab68 -[UIImageView initWithImage:] + 51
6 NumbersFlashCards 0x00003373 -[LettersFlashCardsViewController viewDidLoad] + 3311
7 UIKit 0x0037d65e -[UIViewController view] + 179
8 UIKit 0x0037f012 -[UIViewController viewControllerForRotation] + 63
9 UIKit 0x0037af76 -[UIViewController _visibleView] + 90
10 UIKit 0x00614a97 -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
11 UIKit 0x002f6ba8 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
12 UIKit 0x00576948 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1053
13 UIKit 0x00381982 -[UIViewController presentModalViewController:withTransition:] + 3151
14 NumbersFlashCards 0x00005d83 -[StartPage start] + 103
15 UIKit 0x002cfa6e -[UIApplication sendAction:to:from:forEvent:] + 119
16 UIKit 0x0035e1b5 -[UIControl sendAction:to:forEvent:] + 67
17 UIKit 0x00360647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
18 UIKit 0x0035f438 -[UIControl touchesBegan:withEvent:] + 277
19 UIKit 0x002f4025 -[UIWindow _sendTouchesForEvent:] + 395
20 UIKit 0x002d537a -[UIApplication sendEvent:] + 447
21 UIKit 0x002da732 _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x017f0a36 PurpleEventCallback + 1550
23 CoreFoundation 0x00e9c064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x00dfc6f7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x00df9983 __CFRunLoopRun + 979
26 CoreFoundation 0x00df9240 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x00df9161 CFRunLoopRunInMode + 97
28 GraphicsServices 0x017ef268 GSEventRunModal + 217
29 GraphicsServices 0x017ef32d GSEventRun + 115
30 UIKit 0x002de42e UIApplicationMain + 1160
31 NumbersFlashCards 0x00002320 main + 102
32 NumbersFlashCards 0x000022b1 start + 53
33 ??? 0x00000001 0x0 + 1
)
我知道这个崩溃是在我的代码的第112行处引起的(我用nslogs将它包围以缩小它的范围)。但我在这里没有看到112?我只是不想每次都用nslog来跟踪它。
虽然我不能点击任何东西,但它只是文本。 – Marty 2011-02-27 02:15:34
我看到它坠毁的方法,只是不是实际的线。 – Marty 2011-02-27 02:26:18
该堆栈说它在系统[UIImageView initWithImage:]中的[LettersFlashCardsViewController viewDidLoad]中崩溃。如果你没有一行说:[[UIImageView alloc] initWithImage:...],那么你有一个指针问题,因为这是它可以调用的方法。您可以使用viewDidLoad中的断点重新运行程序,并查看mroe细节。 – DavidPhillipOster 2011-02-27 03:07:37