NSZombieEnabled completely hides EXC_BAD_ACCESS error

So, I have a subclass of UIView that starts to throw EXC_BAD_ACCESS errors when I go through a certain set of conditions (I launch on an iPad instead of an iPhone or a simulator, just for logging in). It throws an exception when a subclass of UIView receives auto-implementation from the pool (that is, the pool is freed, and not when I call [view autorelease], during the last line where I have [super dealloc]. I heard about using NSZombieEnabled, so I threw it to find out if I can get more information about it, but now it completely hides the error!

Does anyone know a little about this type of situation? I thought that NSZombie would start spewing things into my console as before, but I hope that the non-existence of errors will tell me some information.

- (void)dealloc  
{  
    [loadingLabel release];  
    [indicatorView release];  
    [super dealloc];  
} 

Edit: Ok, so I solved the problem:

One of my properties:
@property (nonatomic,retain) NSString * title;

However, the code for this property is as follows (loadLabel is UILabel):

- (void)setTitle:(NSString *)title
{
    loadingLabel.text = title;
    [loadingLabel sizeToFit];
    [self setNeedsLayout];
}

- (NSString *)title
{
    return loadingLabel.text;
}

In fact, I do not save anything, but rather use UILabel.text, which is a copy property. So I changed my title property to reflect this, and the error went away.

However, I still do not know how and why this error occurred in the first place, and why it appears only on the iPad platform (and not on the iphone or even on the ipad simulator).

+3
source share
4

, UIView, EXC_BAD_ACCESS, ( iPad iPhone , ). , UIView (.. , [ autorelease], , [super dealloc]. NSZombieEnabled, , , , !

EXC_BAD_ACCESS, .

NSZombieEnabled . , . ( Xcode), , , .

, NSZombie , , . , ( "" ) , , .

, [] UILabel.text, .

, , , - , . NSZombieEnabled , , .

, , Zombies. , Xcode Debugger Console, . go-to-iTunes-Store (➲), .

+1

- , EXC_BAD_ACCESS () EXC_BAD_ACCESS? ? , . NSZombie , . ?

0

NSZombie , .

ObjectAlloc , ( , ObjectAlloc, "i" ObjectAlloc). , , .

0

, iPad SDK - -, , , , . , .

NSZombie , , release. , . , , , /.

-1

Source: https://habr.com/ru/post/1742150/


All Articles