• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Compile warnings according to method order
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compile warnings according to method order


  • Subject: Compile warnings according to method order
  • From: Martin Kyte <email@hidden>
  • Date: Fri, 10 Aug 2007 09:57:07 +0100

Hi Guys
A question from a beginner.
I am working through Aaron Hillegas's book and have just got the first stages of a cocoa document based application running. In order to acheive undo and redo functionality it uses key value observing. The project compiles with no errors and runs correctly when I write


@implementation MyDocument
- (id)init
{
    ..stuff
}

- (void)startObservingPerson:(Person *)person
{
	[person addObserver:self
			 forKeyPath:@"personName"
				options:NSKeyValueObservingOptionOld
				context:NULL];

	[person addObserver:self
			 forKeyPath:@"expectedRaise"
				options:NSKeyValueObservingOptionOld
				context:NULL];

}

- (void)stopObservingPerson:(Person *)person
{
	[person removeObserver:self forKeyPath:@"personName"];
	[person removeObserver:self forKeyPath:@"expectedRaise"];
}

// . . . . . . . . then the rest of the code

but not when

- (void)startObservingPerson:(Person *)person
{
	...... etc.......
}

- (void)stopObservingPerson:(Person *)person
{
 .... etc....
}

is placed after methods with
[self startObservingPerson:p];
or
[self stopObservingPerson:person];

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:'

Happy for contradiction

Cheers Martin

Martin Kyte
Electronics Workshop
MRC Laboratory of Molecular Biology
Hills Road, Cambridge, CB2 2QH
Tel 01223 252975
email@hidden




_______________________________________________

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


  • Follow-Ups:
    • Re: Compile warnings according to method order
      • From: mmalc crawford <email@hidden>
    • Re: Compile warnings according to method order
      • From: "Sean McBride" <email@hidden>
    • Re: Compile warnings according to method order
      • From: Wincent Colaiuta <email@hidden>
  • Prev by Date: Re: NSTableView and keyPath
  • Next by Date: Re: Compile warnings according to method order
  • Previous by thread: Re: Dynamic Menu Bars
  • Next by thread: Re: Compile warnings according to method order
  • Index(es):
    • Date
    • Thread