iphone ios XCode4如何调试程序忽然崩溃而找不到挂的代码
2011-09-13 17:43
555 查看
XCode4设置不太一样: 在Edit–>Scheme里面 找到Arguments(在xcode 4.2中,在菜单 product->edit scheme中)
把下面3个值设置成YES
NSAutoreleaseFreedObjectCheckEnabled
NSZombieEnabled
NSDebugEnabled
另外转载2篇调试EXC_BAD_ACCESS的好文 http://blog.zol.com.cn/2387/article_2386505.html http://www.cnblogs.com/likwo/archive/2011/02/28/1967066.html
老外也有这么说的:
I had similar issue; turns out I was
not retaining a UIButton properly. How I found the cause: - Enable zombies - Run the project with 'Allocations' instrument - Use the app to trigger the bug - Check that Instruments show message 'Zombie Messaged' on the timeline - There should be a link that
opens CALayer details: when it was allocated and deallocated - You are interested in the place where is was allocated, should be that aha!!! place in your code
我是用模拟器上 使用zombies,然后运行程序,崩溃的时候会有提示崩溃点,同时有代码。
转另一个人文章:
方法一:
PAEHoldTranMainControl *control = [[PAEHoldTranMainControl alloc]init];
[self.navigationController pushViewController:control animated:YES];
[control release];
alloc了一个control,release,运行就崩溃了。而且没有任何提示,console里只显示exc_bad_access
利用NSZombieEnabled参数,MallocStackLogging参数,显示 -[CALayer release]: message sent to deallocated instance 0x13570810
折腾了半天,最后用如下方法定位问题:
打开instrument-->ios simulator:
选择all--》 zombies运行,断开时,查看stack trace,即可跟踪
方法二:例如console里的输出如下:
TestAPP[1472:207] *** -[NSObject release]: message sent to deallocated instance 0x6019170
在 gdb console 里面, 运行 shell malloc_history <pid> <mem_address>
pid = process ID (e.g. 1472)
mem_address = memory address of instance (e.g. 0x6019170)
即会出现调用栈
把下面3个值设置成YES
NSAutoreleaseFreedObjectCheckEnabled
NSZombieEnabled
NSDebugEnabled
另外转载2篇调试EXC_BAD_ACCESS的好文 http://blog.zol.com.cn/2387/article_2386505.html http://www.cnblogs.com/likwo/archive/2011/02/28/1967066.html
老外也有这么说的:
I had similar issue; turns out I was
not retaining a UIButton properly. How I found the cause: - Enable zombies - Run the project with 'Allocations' instrument - Use the app to trigger the bug - Check that Instruments show message 'Zombie Messaged' on the timeline - There should be a link that
opens CALayer details: when it was allocated and deallocated - You are interested in the place where is was allocated, should be that aha!!! place in your code
我是用模拟器上 使用zombies,然后运行程序,崩溃的时候会有提示崩溃点,同时有代码。
转另一个人文章:
方法一:
PAEHoldTranMainControl *control = [[PAEHoldTranMainControl alloc]init];
[self.navigationController pushViewController:control animated:YES];
[control release];
alloc了一个control,release,运行就崩溃了。而且没有任何提示,console里只显示exc_bad_access
利用NSZombieEnabled参数,MallocStackLogging参数,显示 -[CALayer release]: message sent to deallocated instance 0x13570810
折腾了半天,最后用如下方法定位问题:
打开instrument-->ios simulator:
选择all--》 zombies运行,断开时,查看stack trace,即可跟踪
方法二:例如console里的输出如下:
TestAPP[1472:207] *** -[NSObject release]: message sent to deallocated instance 0x6019170
在 gdb console 里面, 运行 shell malloc_history <pid> <mem_address>
pid = process ID (e.g. 1472)
mem_address = memory address of instance (e.g. 0x6019170)
即会出现调用栈
相关文章推荐
- iphone ios XCode4如何调试程序忽然崩溃而找不到挂的代码
- iphone ios XCode4如何调试程序忽然崩溃而找不到挂的代码
- iphone ios XCode4如何调试程序忽然崩溃而找不到挂的代码
- iphone ios XCode4如何调试程序忽然崩溃而找不到挂的代码
- XCode4如何调试程序忽然崩溃而找不到挂的代码
- XCode4如何解决调试程序时,忽然崩溃,而找不到崩溃的代码
- XCode4如何解决调试程序时,忽然崩溃,而找不到崩溃的代码
- XCode4如何解决调试程序时,忽然崩溃,而找不到崩溃的代码
- XCode4如何解决调试程序时,忽然崩溃,而找不到崩溃的代码
- XCode4如何解决调试程序时,忽然崩溃,而找不到崩溃的代码
- XCode4如何解决调试程序时,忽然崩溃,而找不到崩溃的代码
- IOS调试技巧:当程序崩溃的时候怎么办 iphone IOS
- 3. iphone项目如何联机调试和发布程序(99$)
- 如何调试崩溃的程序
- 【iOS开发】如何在程序出错崩溃时快速定位到具体出错代码行
- 论try/catch的重要性,我们经常遇到代码出现无法调试的错误,程序退出的时候崩溃。这跟我们代码日常保护的习惯息息相关。
- iOS调试技巧:当程序崩溃的时候怎么办 iphone iOS
- IOS调试技巧:当程序崩溃的时候怎么办 iphone IOS
- IOS调试技巧:当程序崩溃的时候怎么办 iphone IOS
- linux下调试程序和如何图形化调试,图形化工程代码编写与编译