I am reading a book which says (if I am not getting it wrong) wrapping some code with @autoreleasepool statement enables the ARC. First of all is this the case ?
My second concern is when I am doing some iOS example programs, although I enable ARC when creating a new project, I never see this directive being used anywhere (in the automatically generated code). Does this mean that ARC is not being used ? Any ideas/pointers is appreciated.
@autoreleasepooldoesn’t “enable” ARC. It’s just the ARC way to use autorelease pools.Before ARC, you used the
NSAutoreleasePoolclass to set up an autorelease pool like this:But you’re not allowed to call
releasewhen using ARC, so instead a new way to use autorelease pools was introduced:@autoreleasepoolblocks are more efficient than using an instance ofNSAutoreleasePooldirectly; you can also use them even if you do not use ARC.