i have found two bugs for you code #27

jimzhao2012 opened this Issue Jul 24, 2012 · 1 comment

2 participants


i have found some bugs for this code;

  1. in ELCAssetTablePicker, viewDidLoad [self performSelectorInBackground:@selector(preparePhotos) withObject:nil]; you can not update UI in non-main thread.

-(void)preparePhotos {

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSLog(@"enumerating photos");
[self.assetGroup enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) 
     if(result == nil) 

//must updated in main thread
dispatch_async(dispatch_get_main_queue(), ^{

ELCAsset *elcAsset = [[[ELCAsset alloc] initWithAsset:result] autorelease];
[elcAsset setParent:self];
[self.elcAssets addObject:elcAsset];

NSLog(@"done enumerating photos");

//move the follow code to view did load is much better;
dispatch_async(dispatch_get_main_queue(), ^{

[self.tableView reloadData];
[self.navigationItem setTitle:@"Pick Photos"];
[pool release];


  1. the orientation is not correct in the delegate; i think you'd better change the delegate like this, just pass the ALAsset object to the invoker, do not pass original image, because it used too much memorey.

@protocol ELCImagePickerControllerDelegate

  • (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingAssets:(NSArray *)assets;



We have implemented a solution somewhat similar to yours in version 0.0.3, where we still process the photos on the background thread, but then call the reload on the main queue. As far as getting a representation of the image in the didFinishPickingAssets, I believe this was done so that an image could be shown quickly to the user of what was selected.

@jvanmetre jvanmetre closed this Apr 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment