开发者

low-level iOS crash from UIAlertView _performPopup

I've been getting some low level crashes lately, and this one in particular is hard to determine the origin / state of the app. Has anyone seen this or know the problem? Thanks!

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x3dcccccd Crashed Thread: 0

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x3dcccccd Crashed Thread: 0

Thread 0 Crashed: 0 libobjc.A.dylib 0x000025fa objc_msgSend + 18 1 UIKit 0x00162d1c -[UIAlertView(Private) _performPopup:] + 12 2 UIKit 0x001628de -[UIAlertView(Private) _repopup] + 10 3 UIKit 0x0016d196 -[UIAlertView(Private) _removeAlertWindowOrShowAnOldAlert] + 70 4 UIKit 0x00162afa -[UIAlertView(Private) _popoutAnimationDidStop:finished:] + 502 5 UIKit 0x00050ae4 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184 6 UIKit 0x000509ee -[UIViewAnimationState animationDidStop:finished:] + 34 7 QuartzCore 0x0002ee8c run_animation_callbacks(double, void*) + 284 8 QuartzCore 0x0002ed2c CA::timer_callback(__CFRunLoopTimer*, void*) + 96 9 CoreFoundation 0x00022d1c CFRunLoopRunSpecific + 2092 10 CoreFoundation 0x000224da CFRunLoopRunInMode + 42 11 GraphicsServices 0x000030d4 GSEve开发者_高级运维ntRunModal + 108 12 GraphicsServices 0x00003180 GSEventRun + 56 13 UIKit 0x0000342a -[UIApplication _run] + 374 14 UIKit 0x00001954 UIApplicationMain + 636 15 iPadDrinkHub.1.0.7 0x00002f24 0x1000 + 7972 16 iPadDrinkHub.1.0.7 0x00002ed8 0x1000 + 7896


Weird crashes are sometimes a symptom of memory corruption and/or mismanagement. I just found and fixed a difficult-to-find bug in one of my apps a few days ago. The app had been working flawlessly for 6 months on iOS 3.2, but would crash instantly on iOS 4.2. The crash was happening while adding the main view to the window during applicationDidFinishLaunching. The stack trace showed 100% iOS code; there wasn't a single function of mine in there anywhere (except for applicationDidFinishLaunching). It turned out I was over-releasing a UIImage in code that had been called earlier while views were getting loaded. (I was mistakenly calling release on an autoreleased UIImage).

I haven't seen the specific crash that you're seeing, but here are a few things you can try that may shed some light:

(1) Run the app with NSZombieEnabled. This is an environment variable you set via Xcode that will often identify places where you may be referencing objects that have already been freed (e.g., like the over-release example I mentioned earlier). Additional details are here:

http://www.cocoadev.com/index.pl?NSZombieEnabled

(2) You can turn on logging that will log all messages sent to all objects. The log is a written to a text file in the tmp folder. If you inspect the log file leading up to the crash, you may gain some insight into what's happening right before the crash. This is actually the technique I used to solve my bug. You can either modify your code to enable/disable logging:

instrumentObjcMessageSends(YES);
// Do stuff...
instrumentObjcMessageSends(NO);

Or, you can call the function directly from the debugger. For example, set a breakpoint right before the crash, then drop into the debugger console and do this:

(gdb) call (void)instrumentObjcMessageSends(YES)

Additional details are here:

http://www.dribin.org/dave/blog/archives/2006/04/22/tracing_objc/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜