Re: NSDate Question
Re: NSDate Question
- Subject: Re: NSDate Question
- From: "I. Savant" <email@hidden>
- Date: Thu, 7 Dec 2006 23:06:14 -0500
Because you did not retain myDate (you asked NSDate for +date,
which returns an autoreleased date), you're getting garbage. The line
should read:
myDate = [[NSDate date] retain];
Just remember you need to release the date in your -dealloc method:
-(void)dealloc
{
[myDate release];
[super dealloc];
}
--
I.S.
On Dec 7, 2006, at 10:22 PM, Matt wrote:
- (id) init {
self = [super init];
if (self != nil) {
myDate = [NSDate date];
NSLog(@"%@", myDate);
}
return self;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden