title: ALAssets in a UICollectionViewController do not display image
body: <p>I'm having a problem to display an ALAssets list from the device Gallery in each item of a collectionViewCell.</p>
  
  <p>My images are not visible in the collection view. I tried all the solutions that I found in the relatives posts, but I didn't found the answer... Why?</p>
  
  <p>Here is my dev environment :</p>
  
  <p>iPhone5, 
  IOS 6.0.2, 
  XCode 4.5, 
  using ARC &amp; storyboards.</p>
  
  <p>And here is my code :</p>
  
  <p><strong>1. First, I fetch the MutableArray with device media in my delegate :</strong></p>
  
  <p><em>#AppDelegate.m</em></p>
  
  <pre><code> -(void)loadPhotosFromDevice
   {
      //deviceMedia = [[NSMutableArray alloc] init];
      ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  
      // Enumerate just the photos and videos group by using ALAssetsGroupSavedPhotos.
      if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
      {
          [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos     usingBlock:^(ALAssetsGroup *group, BOOL *stop)
           {
               // Within the group enumeration block, filter if necessary
               [group setAssetsFilter:[ALAssetsFilter allPhotos]];
               [group enumerateAssetsUsingBlock:^(ALAsset *alAsset, NSUInteger index,     BOOL *innerStop)
                {
                    // The end of the enumeration is signaled by asset == nil.
                    if (alAsset)
                    {
                        ALAssetRepresentation *representation = [alAsset defaultRepresentation];
  
                        [self addPhoto:representation andAsset:alAsset];
                    }
                    else
                    {
                        //NSLog(@"Done! Count = %d", deviceMedia.count);
                        //Do something awesome
                    }
                }];
           }
                               failureBlock: ^(NSError *error) {
                                   // Typically you should handle an error more gracefully than this.
                                   NSLog(@"No groups");
                               }];
      }
  }
  </code></pre>
  
  <p><strong>2. I send all my datas with "AddPhoto" Method in an "Media" object class :</strong></p>
  
  <p><em>#AppDelegate.m</em></p>
  
  <pre><code>    -(void)addPhoto:(ALAssetRepresentation *)asset andAsset:alAsset
      {
      //NSLog(@"Adding photo!");
  
      Media *media = [[Media alloc] init];
      media.baseurl = @"";
      media.url = [asset.url absoluteString];
  
      Thumbnail *t = [[Thumbnail alloc] init];
      t.rep = asset;
      t.url = [asset.url absoluteString];
  
      media.thumbnails = [[Thumbnail alloc] initWithRepresentation:asset];
      media.name = asset.filename;
      media.asset = alAsset;
      media.isFromDevice = YES;
      [getPhotos addObject:media];
      NSLog(@"\nDevice Photo added array");
      }
  </code></pre>
  
  <p><em>#Media.h</em></p>
  
  <pre><code> import &lt;AssetsLibrary/AssetsLibrary.h&gt;
  
   @interface Media : NSObject
   {
      //General
      AudioInfo *audioInfo;
      Info *info;
      Header *header;
      Status *requestStatus;
      Exif *exif;
      Thumbnail *thumbnails;
      NSString *name;
      NSString *uploaddt;
      NSString *baseurl;
      NSString *url;
      NSString *createdt;
      NSString *takendt;
      NSString *recorddt;
      ALAsset *asset;
      bool isFromDevice;
  }
  //General
  
      @property (nonatomic, retain) Thumbnail *thumbnails;
      @property (nonatomic, retain) Status *requestStatus;
      @property (nonatomic, retain) NSString *name;
      @property (nonatomic, retain) NSString *uploaddt;
      @property (nonatomic, retain) NSString *baseurl;
      @property (nonatomic, retain) NSString *url;
      @property (nonatomic, retain) NSString *createdt;
      @property (nonatomic, retain) NSString *takendt;
      @property (nonatomic, retain) NSString *recorddt;
      @property (nonatomic, retain) ALAsset *asset;
      @property (nonatomic, readwrite) bool isFromDevice;
  
  @end
  </code></pre>
  
  <p><strong>3. Then I display them in a CollectionViewController :</strong></p>
  
  <p><em>#PhotoDisplayCloudViewController</em></p>
  
  <pre><code>@implementation PhotoDisplayCloudViewController
  
  - (void)viewDidLoad {
      AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
      tableau = appDelegate.getPhotos;
      [super viewDidLoad];
  }
  
  - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
      return 1;
  }
  
  - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
      return tableau.count;
  }
  
  - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
      //CELL
      UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
      Media *object = [[Media alloc] init];
      object = [tableau objectAtIndex:indexPath.row];
  
      //IMAGE
      NSString *url = [NSString stringWithFormat:@"%@%@", object.baseurl, object.thumbnails.url];
      NSLog(@"%@ start loading", object.name);
      UIImageView *image = [[UIImageView alloc] init];
      if (object.isFromDevice)
      {    
          image = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage :[object.asset.self thumbnail]]];          
      }
      else
      {
          image = [[UIImageView alloc] initWithImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString: url]]]];
      } 
      [image setFrame:CGRectMake(image.frame.origin.x, image.frame.origin.y, 72, 72)];
  
      //LABEL
      UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(image.frame.origin.x+6, image.frame.origin.y+58, 60, 12)];
      label.textAlignment = NSTextAlignmentCenter;
      label.textColor = UIColor.blackColor;
      label.contentMode = UIViewContentModeBottom;
      label.font = [UIFont fontWithName:@"Times New Roman" size:9];
      label.text = object.name;
  
      //ADD VIEWS
  
      [cell addSubview:image];
      [cell addSubview:label];
      NSLog(@"%@ end loading", object.name);
  
      return cell;
  }
  
  - (void)didGrabImage:(UIImage *)image {
      [collectionCell addSubview:image];
  }
  
  - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
  {
      PhotoDetailViewController *photoDetailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"photoDetail"];
      photoDetailViewController.MaPhoto=[tableau objectAtIndex:indexPath.row];
      [self.navigationController pushViewController:photoDetailViewController animated:YES];
  
  } 
  @end
  </code></pre>
  
  <p>Please answer me clearly ^^</p>
  
  <p>Advance thx !</p>