コアデータデータベースがあり、ブロック述語を使用してフェッチ要求を作成しようとしていますが、Unknown Predicateエラーが発生します。NSInvalidArgumentException '、理由:述語のための未知の述語型:BLOCKPREDICATE(0x70ad750)'エラー
NOTE: employeeToHouse is a property of type House that was created for me when I subclassed NSManagedObject
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Place"];
request.predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
Place *sortPlace = (Place *)evaluatedObject;
CLLocation *placeLocation = [[CLLocation alloc] initWithLatitude:sortPlace.latitude.doubleValue
longitude:sortPlace.longitude.doubleValue];
CLLocationDistance distance = [placeLocation distanceFromLocation:self.userLocation];
sortPlace.distanceToUser = [NSNumber numberWithDouble:distance];
if(distance<3000)
{
return YES;
}
return NO;
}];
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@ "distanceToUser"
ascending:YES
selector:@selector(localizedCaseInsensitiveCompare:)]];
[self.loadingView removeSpinner];
[self setupFetchedResultsControllerWithFetchRequest:request];
私はこのエラーを取得
:
NSInvalidArgumentException', reason: 'Unknown predicate type for predicate: BLOCKPREDICATE(0x70ad750)'
私が何か間違ったことをやっているの?
「未知の述語タイプ」を使用していますか? –
どういう意味ですか? –
これは、エラーメッセージに表示される内容です。 –