Created
May 14, 2012 08:48
-
-
Save juliengrimault/2692793 to your computer and use it in GitHub Desktop.
Retain cycle in MKNetworkOperation completion handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)viewDidAppear:(BOOL)animated | |
| { | |
| self.operation = [ApplicationDelegate.flickrEngine imagesForTag:@"Singapore" | |
| onCompletion:^(NSMutableArray* images) | |
| { | |
| self.flickrImages = images; //retain cycle here | |
| [self.tableView reloadData];//retain cycle here | |
| } | |
| onError:^(NSError* error) { | |
| }]; | |
| } | |
| - (void)viewDidAppear:(BOOL)animated | |
| { | |
| __weak FlickrTableViewController weakSelf = self; //to prevent retain cycle | |
| self.operation = [ApplicationDelegate.flickrEngine imagesForTag:@"Singapore" | |
| onCompletion:^(NSMutableArray* images) | |
| { | |
| weakSelf.flickrImages = images; | |
| [weakSelf.tableView reloadData]; | |
| } | |
| onError:^(NSError* error) { | |
| }]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment