My application is crashing when I scrolling map with displaying one or more annotation. Without display annotation map is working fine.
Now I can’t understand what is problem here. Please Help Me.
Following is code that I used to display All annotation.
-(void)displayAllAnnotation
{
NSLog(@"%d",[reminderTitle count]);
for (int i=0 ; i<[reminderTitle count]; i++)
{
double templati=[[reminderLatitude objectAtIndex:i]doubleValue];
double templongi=[[reminderLongitude objectAtIndex:i]doubleValue];
CLLocationCoordinate2D coord;
coord.latitude=(CLLocationDegrees)templati;
coord.longitude=(CLLocationDegrees)templongi;
DDAnnotation *ann = [[[DDAnnotation alloc] initWithCoordinate:coord addressDictionary:nil] autorelease];
ann.title = [reminderTitle objectAtIndex:i];
[self.mapView addAnnotation:ann];
[ann release];
}
}
You release ann object two times so your application is crashing.
remove autorelease. just write like this: