Closed kohdesmond closed 12 years ago
It's not really clear from your code where this error is happening. Does it give you any info as to which collection is being enumerated/mutated? Simple KML should return immutable objects. Are you maybe altering kmlNameArray
on another thread or GCD queue?
Hi Incanus,
Thanks for the reply,
i call loadKML:(NSMutableArray *)kmlNameArray from initKMLArray
//location found start reading KML from bundle(at the moment from bundle)
-(void)initKMLArray
{
NSMutableArray tempKMLArray;
tempKMLArray = [[NSMutableArray alloc] init];
//testing first 9 kml only should be [self.frogs count]
NSString kmlName;
// NSString kmlID;
for (int i=0; i<[self.frogs count]; i++)
{
Frog kmlFrog = [self.frogs objectAtIndex:i];
kmlName = kmlFrog.distributionKML;
////nslog(@"KML %@",kmlFrog.distributionKML);
//kmlID = [NSString stringWithFormat:@"%d",kmlFrog.frogID];
[tempKMLArray addObject:kmlName];
}
//[kmlName release];
////nslog(@"tempKMLArray items %@", tempKMLArray);
dispatch_async( dispatch_get_global_queue(0, 0), ^{
[self loadKML:tempKMLArray];
});
}
[self initKMLArray] will be called when location didUpdateToLocation, usually by user pressing refresh button. i did a BOOL, if searching the refresh button are disabled.
I think your problem is the use of dispatch_get_global_queue()
. This is a global concurrent queue, not the main queue which runs on the main UI thread. I think you should try dispatch_get_main_queue()
instead. This isn't related to Simple KML but instead to the proper use of Grand Central Dispatch.
Hi Guys,
I tried to check out a user pinpoint with polygon by looping through all the KMLs. the app always crash @ this point:
//create KML in hidden Mapview -(void)loadKML:(NSMutableArray *)kmlNameArray {
//dispatch_group_t group = dispatch_group_create();