Re: NSClassFromString help
Re: NSClassFromString help
- Subject: Re: NSClassFromString help
- From: Chris Suter <email@hidden>
- Date: Thu, 14 Jun 2007 14:44:07 +1000
On 14/06/2007, at 1:38 PM, William Zumwalt wrote:
I've connected an action from my NSBrowser to this method which I
copied from the SimpleBrowser example (and it compiles), but it's not
compiling in my project.
So I'm trying to step through this thing line by line to get it
working, and as I try to look up 'Class' in the API docs, I'm not
finding anything there, or for super_class.
I keep getting the following error which compiles in the SimpleBrowser
example project ...
error: dereferencing pointer to incomplete type
- (IBAction) classBrowserChanged:(id) sender
{
NSArray *selectionArray = [[networkBrowser path]
componentsSeparatedByString:[networkBrowser pathSeparator]];
NSString *selectedClassificationName = [selectionArray lastObject];
Class selectedClassification =
NSClassFromString(selectedClassificationName);
// Error appears on this line which I can't find any docs
// for on Class or super_class
Class superClass = selectedClassification->super_class;
Don't know why the example is working. It's probably because it
includes a header file that you aren't. struct objc_class is defined
in objc_class.h (Class is just a pointer to one of those).
In any case, you shouldn't be getting the super class that way.
You should really do:
Class superClass = [selectedClassification superClass]
The documentation for this is in the NSObject Class Reference.
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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