Answer the question
In order to leave comments, you need to log in
Can you help with memory and ARC?
Given a class file with extension:
Interface Something : NSObject
@property (assign) NSInteger thing1;
@property(readonly, assign) NSInteger thing2;
- (void)resetAllValues; // I don't know what this does, it's probably just written
Interface Something ()
{
NSInteger thing4;
}
@property (readwrite, assign) NSInteger thing 2; // just change the property of the variable at the top
@property (assign) NSInteger thing 3;
So, in the book from which the code is taken, it is written that since we are using ARC, we do not need to reduce the reference counter ourselves, because ARC will do it for us. But why would he do it for us? Are objects of type NSInteger automatically put into autorelease? Or did the author mean that when these objects are put into @autoreleasepool { ... } in the main file, their reference count will automatically decrement at the end? (and does ALL objects that are wrapped in @autoreleasepool { ... } decrement the reference count? )
Answer the question
In order to leave comments, you need to log in
I hate to disappoint you, but NSInteger is just a typedef over long int/int. Accordingly, it is not an object at all and it cannot have references.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question