Application get crash while using NSAutoreleasepool inside MKMapview regionDidChangeAnimated method

Posted by Ram on Stack Overflow See other posts from Stack Overflow or by Ram
Published on 2010-06-12T11:06:41Z Indexed on 2010/06/12 11:12 UTC
Read the original article Hit count: 420

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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c