I'm starting to learn about objects in Obj-C and have been messing around with NSDate class. I'm a little confused if I need to alloc / init every instance of say, NSDate I would create. Also, if I had to alloc / init this line of code:
... I'm not ever sure how I would do it.
Code:
NSDate *myDateMuchMuchLater = [myDate dateByAddingTimeInterval:(NSTimeInterval)89500000];
... I'm not ever sure how I would do it.
Code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSDate *myDate = [[NSDate alloc] init];
NSLog(@"The current date is %@", myDate);
NSDate *myDateMuchMuchLater = [myDate dateByAddingTimeInterval:(NSTimeInterval)89500000];
NSLog(@"The current date with 89,500,000 seconds added is %@",myDateMuchMuchLater);
[pool drain];
return 0;
}