我一天毀了此消息:如何弄清楚哪些UIView殭屍CALayer屬於Xcode 4的殭屍工具?
*** -[CALayer retainCount]: message sent to deallocated instance 0x656b260
由於我沒有在這種情況下創建的CALayer自己,那隻能是這可能是從一個UIButton任何一個UISlider一個UIView的CALayer的。所以我得到了great answer from Jeff to my question about how to trace this down in Xcode 4。
傑夫建議按Command + I啓動Profiler,然後選擇殭屍工具。事實上,殭屍工具停在了CALayer上,並向我扔了一個更有用的堆棧跟蹤。
但是,堆棧跟蹤並沒有那麼有用,因爲它並沒有告訴我哪一個反對殭屍真的是。每個UIView都有一個CALayer,但重點是我不會自己創建這些CALayer實例。所以在這種情況下,目標是要知道CALayer屬於哪個UIView(按鈕,滑塊等)。
0 libSystem.B.dylib calloc
1 libobjc.A.dylib class_createInstanceXcode4
2 CoreFoundation +[NSObject(NSObject) allocWithZone:]
3 CoreFoundation +[NSObject(NSObject) alloc]
4 UIKit -[UIView _createLayerWithFrame:]
5 UIKit UIViewCommonInitWithFrame
6 UIKit -[UIView initWithFrame:]
7 UIKit -[UIControl initWithFrame:]
8 UIKit -[UIButton initWithFrame:]
9 UIKit +[UIButton buttonWithType:]
10 TestApp +[CCButton buttonWithNormalImage:pressedImageName:] /Users/tom/Documents/testcomp/Projects/TestApp/Xcode4/Classes/CCButton.m:267
11 TestApp -[ConfigView setupCommitBlade] /Users/tom/Documents/testcomp/Projects/TestApp/Xcode4/Classes/ConfigView.m:606
12 TestApp -[ConfigView initWithRootVC:] /Users/tom/Documents/testcomp/Projects/TestApp/Xcode4/Classes/ConfigView.m:714
13 TestApp -[TestAppViewController loadConfigViewIfNeeded] /Users/tom/Documents/testcomp/Projects/TestApp/Xcode4/Classes/TestAppViewController.m:69
14 TestApp -[TestAppViewController viewDidLoad] /Users/tom/Documents/testcomp/Projects/TestApp/Xcode4/Classes/TestAppViewController.m:293
15 UIKit -[UIViewController view]
16 TestApp -[TestAppAppDelegate application:didFinishLaunchingWithOptions:] /Users/tom/Documents/testcomp/Projects/TestApp/Xcode4/Classes/TestAppAppDelegate.m:238
17 UIKit -[UIApplication _callInitializationDelegatesForURL:payload:suspended:]
18 UIKit -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:]
19 UIKit -[UIApplication handleEvent:withNewEvent:]
20 UIKit -[UIApplication sendEvent:]
21 UIKit _UIApplicationHandleEvent
22 GraphicsServices PurpleEventCallback
23 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
24 CoreFoundation __CFRunLoopDoSource1
25 CoreFoundation __CFRunLoopRun
26 CoreFoundation CFRunLoopRunSpecific
27 CoreFoundation CFRunLoopRunInMode
28 UIKit -[UIApplication _run]
29 UIKit UIApplicationMain
30 TestApp main /Users/tom/Documents/testcomp/Projects/TestApp/Xcode4/main.m:14
31 TestApp start
也許有人可以指出一個教程或視頻,它展示瞭如何在Xcode4中描述這樣的問題?據我記得,Xcode 3真的指出哪個反對它,但在這裏我只是看不到邪惡在哪裏。必須有一些經驗法則才能正確解釋堆棧跟蹤/或者殭屍工具爲什麼不直接指出殭屍出現的代碼行的一個很好的理由。
太棒了!但我認爲我沒有使用GDB。 Xcode 4現在不是基於LLVM嗎? – dontWatchMyProfile
無論您使用哪種編譯器,您仍然可以在Xcode中使用GDB。 –
那麼殭屍工具不會自動打開這個標誌? – dontWatchMyProfile