是否可以将CLLocation对象用作字典中的键?当我尝试这个时,[dictionary objectForKey:clLocationObj]总是返回nil,即使已经插入了具有完全相同纬度和经度的CLLocation键.我能做错什么?
for (Location *location in someArray) { CLLocation *locationKey = [[CLLocation alloc] initWithLatitude:[location.latitude doubleValue] longitude:[location.longtitude doubleValue]]; LocationAnnotation *annotationAtLocation = [self.uniqueLocations objectForKey:locationKey]; if (annotationAtLocation == nil) NSLog(@"this is always nil"); }
我从调试中知道,在someArray中有多个Location位置具有相同的纬度和经度.