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: Compile warnings according to method order



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Compile warnings according to method order (From: Martin Kyte <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.