brettlamy

Updated to 2.2.1 Bad Access

Discussion created by brettlamy on Jun 1, 2012
Latest reply on Jun 15, 2012 by njarecha-esristaff
I have my own custom tiledLayer and operation.
Which looks something like this

/////////////////////////////////////////////////////////////////////////////////////
- (NSOperation<AGSTileOperation>*) retrieveImageAsyncForTile:(AGSTile *) tile{
//Create an operation to fetch tile from local cache
S3TileOperation *operation;

if ([self.urlPath length]) {
operation = [[S3TileOperation alloc] initWithTile:tile
urlPath:self.urlPath
fileFormat:self.fileFormat
target:self 
action:@selector(didFinishOperation:)];
} else {
operation = [[S3TileOperation alloc] initWithTile:tile
tileDirectoryPath:self.tileDirectoryPath
fileFormat:self.fileFormat
target:self
action:@selector(didFinishOperation:)];
}

//Add the operation to the queue for execution
[super.operationQueue addOperation:operation];
return [operation autorelease];
}

/////////////////////////////////////////////////////////////////////////////////////
- (void) didFinishOperation:(NSOperation<AGSTileOperation>*)op {
DebugLog(@"didFinishOperation");

//If tile was found ...
if (op.tile.image != nil) {
// Notify tileDelegate of success
[self.tileDelegate tiledLayer:self operationDidGetTile:op];
} else {
// Notify tileDelegate of failure
[self.tileDelegate tiledLayer:self operationDidFailToGetTile:op];
}
}


retrieveImageAsyncForTile Creates a NSOperation which goes and fetches the tile. When the operation finishes I simply call:
[self.target performSelector:self.action withObject:self];
From inside of the NSOperation.

This calles to didFinishOperation in the code above. Everything works fine until I get to:
[self.tileDelegate tiledLayer:self operationDidGetTile:op];

Where the app crashes with a bad access with the following backtrace





The regression occurred when upgrading from 2.0.1 to 2.2.1.

Outcomes