Application get crash while using NSAutoreleasepool inside MKMapview regionDidChangeAnimated method
- by Ram
Hi, i am working on a map application, in that i like to drop the pins (as in Zillow apps) when ever user change the map view. I am using following code code. i am try to load the xml data from server using NSAutoreleasepool to do the xml parsing in the background thread.
(void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{
NSLog(@"inside region did changed ");
urlString =[NSString stringWithFormat: @"http://asdfasdasdf.com/asdfasdf/mapxml.php];
[stories1 release];
[mapview removeAnnotations:eventPoints1];
eventPoints1 = [[NSMutableArray array] retain];
[self performSelectorInBackground:@selector(callParsing) withObject:nil];
}
-(void)callParsing{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self parseXMLFileAtURL:urlString];
[self performSelectorOnMainThread:@selector(droppingPin) withObject:nil waitUntilDone:YES];
[pool drain];
}
The above code is working fine, but once i changed the mapview, the appllication get crashed. Anyone can help me to fix the issue?
thanks in advance.