Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

i have found two bugs for you code #27

Closed
jimzhao2012 opened this Issue July 23, 2012 · 1 comment

2 participants

jimzhao2012 jvanmetre
jimzhao2012

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) 
     {
         return;
     }

//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;

@end

jvanmetre
Owner

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 April 02, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.