I have the following method which retrieves an ALAsset
from the UIImagePicker
after it snaps a photo. It then attempts to send this ALAsset
to another one of my methods via the main thread:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSURL *imageURL = [[info valueForKey:UIImagePickerControllerReferenceURL] retain];
__block ALAsset *result;
[self.assetsLibrary assetForURL:imageURL resultBlock:^(ALAsset *asset)
{
result = [asset retain];
dispatch_async(dispatch_get_main_queue(), ^
{
[self loadPhotoImageViewWithAsset:result];
[self dismissModalViewControllerAnimated:YES];
[imageURL release];
[result release];
});
}
failureBlock:^(NSError *error)
{
}];
}
When I get into the dispatch_async(dispatch_get_main_queue(), ^ block
, result
is showing as nil
. Anyone know what I'm doing wrong here?