Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash when calling custom methods in custom subclass.




On Jul 30, 2005, at 12:01 PM, Adam Raney wrote:

Thanks for you help guys, I;ve gotten a bit closer to solving my
problem. It seems I can't simply call an instance of a custom class by
making a variable with it as I had before:

ACRQuizProblemRowElement *newElement;

But instead needed to explicity allocate and initialize it:

ACRQuizProblemRowElement *newElement = [[ACRQuizProblemRowElement alloc] init];

Also taking your advice, my setters now utilize this format:

- (void) setContent: (NSString *)newContent
{
[_content release];
_content = [newContent copy];
}

This works fine in most situations, except when I am trying to set the array.

- (void) setAnswers: (NSArray *)newAnswers
{
[_answers release];
_answers = [NSArray copy];
}


It's not clear why you're not following the implementation pattern clearly set out in the documentation and in other references?


mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Crash when calling custom methods in custom subclass. (From: Adam Raney <email@hidden>)
 >Re: Crash when calling custom methods in custom subclass. (From: Charilaos Skiadas <email@hidden>)
 >Re: Crash when calling custom methods in custom subclass. (From: Adam Raney <email@hidden>)
 >Re: Crash when calling custom methods in custom subclass. (From: Adam Raney <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.