我收到以下错误
2011-09-05 08:08:43.506 CaveConditions[7203:11903] -[NSManagedObject coordinate]: unrecognized selector sent to instance 0x7471910
2011-09-05 08:08:43.507 CaveConditions[7203:11903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject coordinate]: unrecognized selector sent to instance 0x7471910'
这就是我所说的
NSFetchRequest *request = [[NSFetchRequest alloc] init];
request.entity = [NSEntityDescription entityForName:@"Cave" inManagedObjectContext:self.context];
request.predicate = [NSPredicate predicateWithFormat:@"(latitude > 0) AND (longitude > 0)"];
[self.mapView addAnnotations:[self.context executeFetchRequest:request error:NULL]];
它在 addAnnotations 行崩溃
在我的 Cave.h 中(它作为 MKAnnotation 代表)
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
在我的洞穴.m
- (CLLocationCoordinate2D)coordinate
{
CLLocationCoordinate2D location;
location.latitude = [self.latitude doubleValue];
location.longitude = [self.longitude doubleValue];
return location;
}
我错过了什么吗?