Re: Help with Basics
Re: Help with Basics
- Subject: Re: Help with Basics
- From: Jerry Krinock <email@hidden>
- Date: Tue, 23 Nov 2010 09:30:56 -0800
The thing that jumps out at me is that you're directly accessing the instance variable myKeys instead of using an accessor. I'm not sure why you want this to be a mutable array, but assuming that, I would use a method like this:
- (NSMutableArray*)myKeys {
if (!m_myKeys) {
// Executes on the first invocation only
myKeys = [[NSMutableArray alloc] init] ;
}
return m_myKeys ;
}
then access it with [self myKeys]. Also, remember to [m_myKeys release] in your -dealloc method?
>> The way you've now written things will cause your app to crash. I'll leave the reason for the crash as an exercise for you to figure out.
Well, does it crash?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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