Hi friends,
When I use mantle to parse JSON, because the returned data is an array, instead of a Dictionary directly, so I have to use " fromJSONArray".
- (RACSignal *)fetchCurrentDataForLocation:(CLLocationCoordinate2D)coordinate{
NSString *urlString = [NSString stringWithFormat:@"...a certain url"];
NSURL *url = [NSURL URLWithString:urlString];
return [[self fetchJSONFromURL:url] map:^(NSArray *json) {
return [MTLJSONAdapter modelOfClass:[CertainClass class] fromJSONArray:json error:nil];
}];
}I get error prompt as follows: "No known class method for selector 'modelOfClass: fromJSONArray:error: ".
Please help. thanks!
When I use mantle to parse JSON, because the returned data is an array, instead of a Dictionary directly, so I have to use " fromJSONArray".
- (RACSignal *)fetchCurrentDataForLocation:(CLLocationCoordinate2D)coordinate{
NSString *urlString = [NSString stringWithFormat:@"...a certain url"];
NSURL *url = [NSURL URLWithString:urlString];
return [[self fetchJSONFromURL:url] map:^(NSArray *json) {
return [MTLJSONAdapter modelOfClass:[CertainClass class] fromJSONArray:json error:nil];
}];
}I get error prompt as follows: "No known class method for selector 'modelOfClass: fromJSONArray:error: ".
Please help. thanks!
+ (NSArray *)modelsOfClass:(Class)modelClass fromJSONArray:(NSArray *)JSONArray error:(NSError **)error;