favorites = [[NSMutableArray alloc] init];
for (int i=0; i<9; i++) {
[favorites addObject:[[[Favorite alloc] constructUnknown] autorelease]];
}
i'm getting:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[Favorite size]: unrecognized selector sent to instance 0x380d9c0'
why?
Favorite is my custom class, favorites an array containing 9 instances of my custom class
edit:
Favorite.h:
-(Favorite*)constructUnknown;
Favorite.m:
- (Favorite*)constructUnknown{
self=[super init];
if (self) {
image=[UIImage imageNamed:@"unknown.png"];
}
return self;
}
COMPLETE FAVORITES.h
@interface Favorite : NSObject {
NSString *identity;
bool ready;
UIImage *image;
NSURL *telephone;
}
@property (nonatomic,retain) UIImage *image;
@property (nonatomic,retain) NSURL *telephone;
@property (nonatomic,retain) NSString *identity;
//passare unknown al nome per costrutire un oggetto unknown.
-(Favorite*)constructWithID:(NSString*)name withPhoto:(UIImage*)photo andNumber:(NSString*)number;
-(Favorite*)constructUnknown;
-(NSURL*) convertToUrl:(NSString*)phone;
- (UIImage*) getImage;
@end