I created a class called “card” with the following header file and a body file with the @synthesize’s. The problem is that the app crashes when i try to get the value of typeOfCard. Am i stupid? When i debug it, the inspctor tells me that this variable is an int and it tells me the correct value, but then the app crashes with the following error:
* Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSArrayM idOfImage]: unrecognized selector sent to instance 0x190f64e0’
#import <Foundation/Foundation.h>
enum cardType {
hearth = 0,
bell = 1,
acorn = 2,
leaf = 3
};
@interface card : NSObject {
int value;
int idOfImage;
enum cardType typeOfCard;
}
@property (assign)int value;
@property (assign)int idOfImage;
@property enum cardType typeOfCard;
@end
try changing the following:
1) declare your enum like (tip: use capital letters for enumerators, same as with classes)
2) correct your @property line
3) make sure you have the
@synthesize typeOfCard;in your .m