关于xcode Objective-C EXC_BAD_ACCESS问题

XCode调试技巧之EXC_BAD_ACCESS中BUG解决是本文要介绍的内容,在iphone开发的时候EXC_BAD_ACCESS这个bug时不容易找到原因的,
自己在网上找到的有关于这个问题的方法,研究了一下还真把问题给解决了!
http://www.iteye.com/topic/550550
http://lovebirdegg.iteye.com/blog/550489
http://xcodev.com/wordpress/?p=209
http://mobile.51cto.com/iphone-279455.htm
http://blog.csdn.net/sjzsp/article/details/6386987
http://stackoverflow.com/questions/2190227/how-do-i-setup-nszombieenabled-in-xcode-4

首先,在Xcode中打开executables XXXX get info->Argument

在Argument卡设置四个参数
关于xcode Objective-C EXC_BAD_ACCESS问题_第1张图片
gdb命令:shell malloc_history pid address 或 info malloc-history address
用法 http://mobile.51cto.com/iphone-279455.htm 这里介绍很详细。

当问题解决后,要将NSDebugEnabled NSZombieEnabled MallocStackLogging 设置为无效,不需要删除变MallocStackLoggingNoCompact量,将变量前的对号去掉就可以了。


<==========================================================================>


xcode4以上的版本:Product -> Edit Scheme -> 右边框Diagnostic。

或:

Click the "Run Button Dropdown"
From the list choose Profile
The program "Instruments" should open where you can also choose Zombies
Now you can interact with your app and try to cause the error
As soon as the error happens you should get a hint on when your object was released and therefore deallocated.


As soon as a zombie is detected you then get a neat "Zombie Stack" that shows you when the object in question was allocated and where it was retained or released:
Event Type    RefCt     Responsible Caller
Malloc            1     -[MyViewController loadData:]
Retain            2     -[MyDataManager initWithBaseURL:]
Release           1     -[MyDataManager initWithBaseURL:]
Release           0     -[MyViewController loadData:]
Zombie           -1     -[MyService prepareURLReuqest]


你可能感兴趣的:(object,xcode,Scheme,Access,button,XCode4)