Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7084703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:20:05+00:00 2026-05-28T07:20:05+00:00

I have implemented a custom gallery with two UIViewController subclasses: AlbumController and PhotosController .

  • 0

I have implemented a custom gallery with two UIViewController subclasses: AlbumController and PhotosController. The first one shows all gallery albums, and the second one, all photos from the selected album.

Everything works fine except when I am downloading images from a remote repository (Flickr at the moment) to the Camera Roll album. In that case, whenever I go to the AlbumController I see all the albums, and the album cover of the Camera Roll is refreshed with the last downloaded image, but when I go to the PhotosController for the Camera Roll album, I don’t see anything. If I enter the Camera Roll album after all images have been downloaded, then I see them all.

PhotosController.h:

ALAssetsGroup *album;

PhotosController.m:

-(void) viewDidAppear:(BOOL)animated{
    if( albumHasChanged ){
        [self performSelectorInBackground:@selector(prepareAlbumPhotos) 
                               withObject:nil];
        [self performSelector:@selector(reloadPhotosTableView) 
                   withObject:nil 
                   afterDelay:.5];            
        albumHasChanged = NO;
    }
}

#pragma mark - Private methods

-(void)prepareAlbumPhotos {
    [albumAssets removeAllObjects];

    @autoreleasepool {
        [self.album enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) 
         {
             // No assets are returned while images are being downloaded!!

             // ... albumAssets gets filled
         }];

        [self reloadPhotosTableView];
    }
}

-(void) reloadPhotosTableView{
    [photosTableView reloadData];
}

Inside another class I download the images and add them to the gallery like so:

UIImage *img = [UIImage imageWithData:data];
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);    

Can anybody explain why enumerateAssetsUsingBlock: does not return any assets while writing images to its ALAssetsGroup?

Is there a workaround to read assets from the Camera Roll album in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:20:06+00:00Added an answer on May 28, 2026 at 7:20 am

    The problem was that every time you save a new image in the phone Gallery, the reference to the Camera Roll ALAssetsGroup changes and is no longer valid (not nil though).

    In my case I was downloading and writing many images so each time I tried to view them in my gallery, the reference to the album had changed, and therefore, enumerateAssetsUsingBlock: wasn’t returning anything.

    To avoid this problem, first I download all images to a folder, and then, I copy the images to the gallery blocking the application with an UIAlertView message, with no buttons, notifying the process. With this implementation I solved the problem.

    If you want to save some images at the same time, you could find another problem. Have a look at this question and answer as well: https://stackoverflow.com/a/8177014

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a custom ActionMapper which obtains the locale from the URI (the
I have a custom component where I have implemented INotifyPropertyChanged and IBindableComponent . However,
I have implemented custom validation for my JSP forms and when there are errors
I have implemented custom errors in my asp.net mvc application by following this article
I have implemented custom draw for an CTreeCtrl in my MFC Smart Device program.
I have implemented a custom movie player with AVPlayer . On setting the value
I have implemented a custom route (inherit from RouteBase) to have dynamic routes based
I have implemented my custom button inheriting from CButton and drawing it by using
I need to have a custom interpolator for the Gallery widget. I checked the
So, I have implemented custom routing in mysite. routes.MapRoute( WithFriendlyNameOnly, {friendlyName}, new { controller

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.