• 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
Re: NSService - I need a headslap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSService - I need a headslap


  • Subject: Re: NSService - I need a headslap
  • From: Michael Ash <email@hidden>
  • Date: Wed, 4 Feb 2009 17:55:56 -0500

On Wed, Feb 4, 2009 at 10:03 AM, Steve Cronin <email@hidden> wrote:
> Well, sheesh - that's embarrassing!   There is no 'self' until init - I know
> that!  Ugh.

Sure there is. There's a 'self' in every method. It refers to the
receiver of the message that was sent. In instance methods, 'self'
refers to the instance. In class methods, 'self' refers to the class.
Example:

@implementation Foo
+ foo {
   NSLog(@"self is %@ (%p) and Foo is %@ (%p)", self, self, [Foo
class], [Foo class]);
}
@end

You'll get the same values for both, since they give you the same thing.

Of course it's the class, not the instance, so the self you have isn't
the self you *wanted* here.

Mike
_______________________________________________

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

References: 
 >NSService - I need a headslap (From: Steve Cronin <email@hidden>)
 >Re: NSService - I need a headslap (From: Ron Fleckner <email@hidden>)
 >Re: NSService - I need a headslap (From: Steve Cronin <email@hidden>)

  • Prev by Date: Re: Confused about NSTrackingAreas with autoscroll
  • Next by Date: Re: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string
  • Previous by thread: Re: NSService - I need a headslap
  • Next by thread: NSTask in separate thread is leaking memory
  • Index(es):
    • Date
    • Thread