Hi I’m new to objective C.
In the old version of Xcode, when we create new project the IDE generate NSAutoreleasePool object like below to allow auto release an object
int main (int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[pool drain];
return 0; }
However in the Xcode 4.3, the IDE generate the below code
int main (int argc, const char * argv[])
{
@autoreleasepool {
//insert code
}
return 0;
}
With the older version .. i could manually release the object .. With the new Xcode 4.3 when i tried release the object but the release function is crossed out … Why is that…?
Thank you.
ARC (Automatic Reference Counting) is enables in your project. In ARC, reference count operations (ex. release) on objects are not allowed. The red line through “release” simply means that the method is deprecated, or no longer needed. The system will release everything for you.