• 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: I Never get 'self' in Obj-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I Never get 'self' in Obj-C


  • Subject: Re: I Never get 'self' in Obj-C
  • From: "J. Todd Slack" <email@hidden>
  • Date: Mon, 5 May 2008 15:55:59 -0700

Hi All,

I have the following:

statusItem = [[[NSStatusBar systemStatusBar]
     statusItemWithLength:NSVariableStatusItemLength]
     retain];
  [statusItem setHighlightMode:YES];
  [statusItem setTitle:[NSString stringWithFormat:@"%C",0x260F]];
  [statusItem setEnabled:YES];
  [statusItem setToolTip:@"Ring-Maker"];

  [statusItem setTarget:self];


The compiler complains about self; saying: iTunesPlugIn.m:606: error: 'self' undeclared (first use in this function)\

First guess:
It's not in a method of an object; it's in free-standing code.
To use SELF, you have to be in an object's method.

OK, I think it is because I dont understand mixing C and Objective-C.

I have a .c file that I put a .m extension on. I want to mix some Objective-C Code when the plug-in is initialized.

Does anyone have an example of how to put Obj-C (like an NSStatusItem) in with C?

-Jason

_______________________________________________

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: I Never get 'self' in Obj-C
      • From: Bill Cheeseman <email@hidden>
    • Re: I Never get 'self' in Obj-C
      • From: Michael Vannorsdel <email@hidden>
References: 
 >I Never get 'self' in Obj-C (From: "J. Todd Slack" <email@hidden>)
 >Re: I Never get 'self' in Obj-C (From: Steve Bird <email@hidden>)

  • Prev by Date: Re: What do these errors mean?
  • Next by Date: Re: Accessing attributes of XML
  • Previous by thread: Re: I Never get 'self' in Obj-C
  • Next by thread: Re: I Never get 'self' in Obj-C
  • Index(es):
    • Date
    • Thread