Hi
I'm trying to iterate over a collection of objects and create an annotation for each object as seen in this code, but at the closing }
of the for
loop i get this error Selector element does not have valid object type
. What does this mean?
for (POI myPOI in appDelegate.pois){
CLLocationCoordinate2D location;
location.latitude=[myPOI.lat doubleValue];
location.longitude=[myPOI.lon doubleValue];
region.span=span;
region.center=location;
LocationAnnotation *locAnn;
locAnn = [[LocationAnnotation alloc] initWithCoordinate:location];
[mapView addAnnotation:locAnn];
[mapView setRegion:region animated:YES];
[locAnn release];
}
Also i get Variable sized object cannot be initialized
at the beginning of the loop. And, instance variable lat (and lon too) is declared protected
.
What have i done wrong?
Thanks