Hi Guys,
I am creating annotations from database. But when I click on annotation to show bubble application crashes. But when I hardcode the coordinates and create placemarks on map the bubbles popup successfully. below is the code I am fetching from database and loading annotations.
-(void) mapView:(MKMapView *)imnMapView didAddAnnotationViews:(NSArray *)views; {
BOOL *regionSet=FALSE;
while(sqlite3_step(compiledStatement) == SQLITE_ROW)
{
CLLocationCoordinate2D userCoods1;
NSString *lat = [NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement, 3)];
NSString *longg = [NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement, 4)];
float fLat = [lat floatValue];
float fLong = [longg floatValue];
userCoods1.latitude = (CLLocationDegrees)fLat;
userCoods1.longitude = (CLLocationDegrees)fLong;
if(regionSet == FALSE)
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userCoods1,400000,500000);
[mapView setRegion:region animated:YES];
regionSet=TRUE;
}
NSString *siteName = [NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement, 1)];
NSString *siteAddress = [NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement, 2)];
ParkPlaceMark *placemark=[[ParkPlaceMark alloc] initWithCoordinate1:userCoods1 title:siteName subtitle:siteAddress atm:@"ATM"];
pDescription = @"ATM";
[mapView addAnnotation:placemark];
[placemark release];
}
}
sqlite3_finalize(compiledStatement);
}
}
And When i just change the userCoords hardcoded and create three different placemarks the bubbles popup and works fine. Please help me getting out of this. thanks in advance.