Subclass NSObject, can this cause problems?

I have a very simple data class that is subclassed from NSObject. I declare a few lines, make sure that they have properties (non-atomic, copies) and are synthesized. The only method I implemented was dealloc (), which releases my lines. Is this causing memory problems? Are there any other methods that I need to implement?

+3
source share
4 answers

A subclass of NSObject is what we do all the time. Just follow the rules of memory management, and you are good to go.

+9
source

init, - .

-(id)init {
    if (!(self = [super init]))
          return nil;

    // Set things up you might need setting up.
    return self;
}

-, , - .

dealloc , .

+4

. NSObject , 99% .

NSObject , Cocoa/Cocoa Touch. , retain release ..

+2

, , . [super dealloc] -dealloc.

+1

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


All Articles