Unrecognized selector sent to instance error
Closed this issue · 1 comments
Volcinator commented
I have a custom class ResponseIdSearch : Response (Response obviously extends Jastor and defines several string and int vars) that is getting an unrecognized selector error sent to it when an Array of complex objects.
ResponseIdSearch *salesResponse = [[ResponseIdSearch alloc] initWithDictionary:dictionaryFromJSON];
The line it fails on is Jastor.m:43
Class arrayItemType = [[self class] performSelector:NSSelectorFromString([NSString stringWithFormat:@"%@_class", key])];
which results in
2013-06-06 13:32:14.067 MyApp[55784:c07] +[ResponseIdSearch sales_class]: unrecognized selector sent to class 0x53db38
Where "sales" is the key in the Dictionary and there are 7 elements to the array.
Volcinator commented
And of course, right after I post this I find the answer. I had to implement the *_class method for my "sales" array:
+ (Class)sales_class { // used by Jastor
return [SalesResult class];
}