Hi guys,
Did something change in Objective-C I am un-aware of?
I was helping my friend work through the Big Nerd Ranch Objective-C book and look at this code:
I go in an out of using Objective-C but I could have sworn you used to have to write something like this:
NSDate *now = [[NSDate alloc] init];
[NSDate date];
I know the syntax for autoreleasepool is different now too (not sure why) but did something change here? Should I go out and update my Objective-C books?
Did something change in Objective-C I am un-aware of?
I was helping my friend work through the Big Nerd Ranch Objective-C book and look at this code:
Code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSDate *now = [NSDate date]; //Why not NSDate *now = [[NSDate alloc] init]; ? Does this mean ARC is turned on?
NSLog(@"The new date lives at %@", now);
}
return 0;
}
I go in an out of using Objective-C but I could have sworn you used to have to write something like this:
NSDate *now = [[NSDate alloc] init];
[NSDate date];
I know the syntax for autoreleasepool is different now too (not sure why) but did something change here? Should I go out and update my Objective-C books?