• 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: obj-c newb question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: obj-c newb question


  • Subject: Re: obj-c newb question
  • From: Chris Hanson <email@hidden>
  • Date: Tue, 4 Nov 2003 20:24:18 -0600

On Nov 4, 2003, at 6:40 PM, Michael Stevenson wrote:
@interface doop : NSObject {

Style: Class names typically start with an upper-case letter.

UInt32 DataSize;

Style: Instance variable names typically start with a lower-case letter. This is very important, because the Key-Value Coding machinery expects it.

-(AudioDeviceID)GetDefaultDevice;

Style: Method names typically start with a lower-case letter. This is very important, because the Key-Value Coding machinery expects it.

Style: Accessor methods that return a value typically don't start with "get." Methods that fill in a pointer typically start with "get" but you shouldn't use such a style for simple accessors.

-(char*)GetDeviceName:(AudioDeviceID)device;
-(char*)GetManufacturerName:(AudioDeviceID)device;

Style: Generally you should return objects, not C types, from methods. This is particularly the case for strings.

-(AudioDeviceID)GetDefaultDevice {
DataSize = sizeof(char*);
status =
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
&DataSize, (void*)&deviceID);

Why did you set dataSize to sizeof(char*)? You should set it to sizeof(AudioDeviceID) explicitly, since that's what you're retrieving.

As for why you're getting the "may not respond to," in the file where you're actually instantiating and using the Doop class, are you including the header file where Doop's interface is defined? If you aren't, the compiler won't know anything about what selectors the class or instances of the class respond to.

Oh, one other thing: It's the compiler, GCC, that's actually giving you an error. Xcode is just the IDE.

-- Chris

--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Outsourcing Vendor Evaluation | Phone: +1-847-372-3955
Custom Mac OS X Development | Fax: +1-847-589-3738
http://bdistributed.com/ | Personal Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: obj-c newb question
      • From: Michael Stevenson <email@hidden>
References: 
 >obj-c newb question (From: Michael Stevenson <email@hidden>)

  • Prev by Date: Re: Help with Undo and MVC
  • Next by Date: Re: Running an App as Root
  • Previous by thread: Re: obj-c newb question
  • Next by thread: Re: obj-c newb question
  • Index(es):
    • Date
    • Thread