Tento extrair dados de CoreData com o seguinte código
NSFetchRequest *request = [[NSFetchRequest alloc] init];
request.entity = [NSEntityDescription entityForName:@"Cave" inManagedObjectContext:self.context];
request.predicate = [NSPredicate predicateWithFormat:@"(latitude > 0) AND (longitude > 0)"];
NSError *error;
NSLog(@"%@",[self.context executeFetchRequest:request error:&error]);
NSLog(@"%@",[error localizedDescription]);
CoreData deve ter 9 objetos correspondentes e encontra os 9 objetos. Então, o predicado deve funcionar, mas eu pego isso no console
2011-09-05 07:41:42.267 CaveConditions[6930:11903] (
"<NSManagedObject: 0x7368060> (entity: Cave; id: 0x7367880 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p31> ; data: <fault>)",
"<NSManagedObject: 0x73547e0> (entity: Cave; id: 0x7356e20 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p40> ; data: <fault>)",
"<NSManagedObject: 0x73681e0> (entity: Cave; id: 0x7363e60 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p42> ; data: <fault>)",
"<NSManagedObject: 0x7368280> (entity: Cave; id: 0x7356be0 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p72> ; data: <fault>)",
"<NSManagedObject: 0x7368320> (entity: Cave; id: 0x733ad80 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p73> ; data: <fault>)",
"<NSManagedObject: 0x73683c0> (entity: Cave; id: 0x7333e70 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p91> ; data: <fault>)",
"<NSManagedObject: 0x7368480> (entity: Cave; id: 0x7361810 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p101> ; data: <fault>)",
"<NSManagedObject: 0x7368570> (entity: Cave; id: 0x7360110 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p105> ; data: <fault>)",
"<NSManagedObject: 0x7368610> (entity: Cave; id: 0x73303c0 <x-coredata://C825FC9D-3490-4D8A-A811-979B819A2EB6/Cave/p112> ; data: <fault>)"
)
Costumava funcionar perfeitamente bem até que fiz a seguinte alteração em Cave.m que é a Entidade
Eu adicionei MKAnnotation como um delegado em Cave.h e adicionei este código em Cave.m
- (CLLocationCoordinate2D)coordinate
{
CLLocationCoordinate2D location;
location.latitude = [self.latitude doubleValue];
location.longitude = [self.longitude doubleValue];
return location;
}
Existe uma maneira de depurar isso?