查看EXC_BAD_ACCESS或SIGABRT的方法



1.打开XCode -> Product -> Edit Scheme 

2.选择Arguements的Environment Varibles中添加NSZombieEnabled YES


测试代码

UILabel *label = [[UILabelalloc]initWithFrame:CGRectMake(0,0,102,102)];

[label release];

[self.view addSubview:label];


使用前结果:

-[NSPathStore2 frame]: unrecognized selector sent to instance 0x1f55eff0

 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 frame]: unrecognized selector sent to instance 0x1f55eff0'

代码跳回main函数


使用后:

 -[UILabel superview]: message sent to deallocated instance 0x1fd30540


你可能感兴趣的:(ios,apple,xcode,Scheme)