मेरे पास एक कोर डेटा डेटाबेस है और मैं ब्लॉक अनुमान का उपयोग करके एक fetch अनुरोध बनाने का प्रयास कर रहा हूं, लेकिन मुझे अज्ञात पूर्वानुमान त्रुटि मिलती है:NSInvalidArgumentException ', कारण:' पूर्वानुमान के लिए अज्ञात predicate प्रकार: 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)'
मैं कुछ गलत कर रहा हूं?
क्या आप "अज्ञात भविष्य प्रकार" का उपयोग कर रहे हैं? –
आपका क्या मतलब है? –
ठीक है, त्रुटि संदेश कहता है। –