my .h file is as follows
#import <Foundation/Foundation.h> @interface MyClass : NSObject { } - (void) addWidget: (Widget*)aWidget; @end
For sake of example, Widget is just some simple class that only holds a couple of strings. Apparently, either i’m doing something wrong or am just spoiled by Java / C# because when I try building, the compiler tells me that i can’t use an object as a parameter to a method.
Does anyone know what I’m doing wrong? Or do objective-c methods not accept complex types? (say it ain’t so!)
[UPDATE] Ok this is odd.. but I just selected ‘clean’ from the Build menu and now the error went away.. ah.. such misdirection on my part.
The only thing wrong with that code is that Widget isn’t declared anywhere. You should either
#import 'Widget.h'or put@class Widget;before the type is used.