Hi everyone,
I'm not 100% certain that this fourm deals with Objective-C, but it is the closest I could find. If it does not, please excuse me (and can you recommend a forum for OC).
I'm an experienced programmer but am brand new to Objective C. My learning was going well until I hit the following problem -
I just want to create a class, instantiate it, and set/get the value for a property (of type NSInteger).
Unfortunately, it doesn't work. I get a compiler warning saying:
"warning 'SimpleClass' may not respond to '-simpleValue' "
It isn't just a compiler warning complaining about the order of things in the file. It doesn't work at all. When it his the [myClass simpleValue:10]; it steps ito the assembly code and then exits the function. The console shows:
*** -[SimpleClass simpleValue:]: unrecognized selector sent to instance 0x11a300
I've tried a couple of ways of casting the value, 10, to an NSInteger, but either I'm not doing it correctly, or it is not the problem.
Any help would be greatly appreciated.
Thanks in advance,
Chris
Code:#import <Cocoa/Cocoa.h> @interface SimpleClass : NSObject { NSInteger simpleValue; } @property (assign) NSInteger simpleValue; @end #import "SimpleClass.h" @implementation SimpleClass @synthesize simpleValue; @end ***** THE PROPERTY IS USED IN THIS METHOD *********** @implementation CustomTypeProperty - (IBAction)click_CustomPropertyType:(id)sender { SimpleClass *myClass=[[SimpleClass alloc] init]; [myClass simpleValue:10]; //**** WARNING MESSAGE ON THIS LINE **** NSLog(@"DONE"); // *** NEVER HIT *** } @end


LinkBack URL
About LinkBacks




Reply With Quote


Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum