I'm familiar with the delegate pattern and nilling my delegates, especially when doing asynchronous calls which are still in progress when my view controllers disappear. I nil the delegate, and the callback successfully returns on a nil object.

I'm now experimenting with using completion blocks to make my code a little easier to read.

I call a network service from my view controller, and pass a block which updates my UITableView. Under normal circumstances it works fine. However, if I leave the view before it completes, the completion handler block is executed - but the UITableView is now a zombie.

Whats the usual pattern for handling this?

**UPDATE WITH CODE SAMPLE**

This is an iPad app, I have two view controllers on screen at once, like a split view. One is the detail, and the other is a grid of images. I click an image and it tell the detail to load the info. However, if i click the images too fast before they have chance to do the network call - I have the problems. On changing images the code below is called which counts the favourites of a image....

So here is my dilemma, if I use the code below - it works fine but it leaks in instruments if you switch images before the network responds.

If I remove the \_\_block and pass in self, then it crashes with zombies.

I can't win... I'm sure i'm missing something fundamental about using blocks.

```
__block UITableView *theTable = [self.table retain];
__block IndexedDictionary *tableData = [self.descriptionKeyValues retain];
FavouritesController *favourites = [Container controllerWithClass:FavouritesController.class];
[favourites countFavouritesForPhoto:self.photo 
                         completion:^(int favesCount) {

                             [tableData insertObject:[NSString stringWithFormat:@"%i", favesCount]   
                                              forKey:@"Favourites:" atIndex:1];                 
                             [theTable reloadData];

                             [tableData release];
                             [theTable release];
                         }];

```

Any tips? Thanks

**SECOND UPDATE**

I changed the way I loaded the favourites. Instead of the favourites being a singleton, I create an instance on each photo change. By replacing this and killing the old one - the block has nowhere to callback (i guess it doesn't even exist) and my code now just looks like the below, and it appear to be working:

```
[self.favourites countFavouritesForPhoto:self.photo 
                         completion:^(int favesCount) {      
                             [self.descriptionKeyValues insertObject:[NSString stringWithFormat:@"%i", favesCount]   
                                              forKey:@"Favourites:" atIndex:1];                 
                             [self.table reloadData];
                         }];

```

It doesn't leak, and doesn't appear to be crashing either.