Re: Compile warnings according to method order
Re: Compile warnings according to method order
- Subject: Re: Compile warnings according to method order
- From: "Sean McBride" <email@hidden>
- Date: Fri, 10 Aug 2007 11:39:45 -0400
- Organization: Rogue Research
On 8/10/07 9:57 AM, Martin Kyte said:
>I thought in my simple understanding methods could go in any order.
>warnings look like this and the application indeed does not respond
>as it should
>
>Building target "RaiseMan" of project "RaiseMan" with configuration
>"Debug" -- (3 warnings)
>
> 'MyDocument' may not respond to '-stopObservingPerson:'
> 'MyDocument' may not respond to '-startObservingPerson:'
> 'MyDocument' may not respond to '-startObservingPerson:'
That's just the compiler being stupid, as Wincent described.
I think it is best to order methods in your .m file so this doesn't
happen. Sometimes though, you can't, and in that case you could do as
Wincent described and declare the methods in your .h file, but this
breaks the interface/implementation separation, which is very bad imho.
Instead, at the top of your .m file, do this:
// Private methods to be used only by this class, put here to prevent
compiler warning
@interface MyClass(MyClassPrivate)
- (void)startObservingPerson:(Person *)person;
- (void)stopObservingPerson:(Person *)person;
@end
hth,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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