Re: obj-c newb question
Re: obj-c newb question
- Subject: Re: obj-c newb question
- From: Michael Stevenson <email@hidden>
- Date: Tue, 4 Nov 2003 21:41:51 -0600
thanks for the style suggestions, like I said, this was just something
I was throwing together to make sure that I was understanding
the obj-c syntax. anyhow.. the header is included... so any ideas on
why I'm getting the problem?
On Nov 4, 2003, at 8:24 PM, Chris Hanson wrote:
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.
_______________________________________________
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.