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

  • SEARCH
  • Home
  • 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 929297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:08:53+00:00 2026-05-15T20:08:53+00:00

So this one is pretty odd ad I’m not sure if the trouble is

  • 0

So this one is pretty odd ad I’m not sure if the trouble is with the AssetsLibrary API, but I can’t figure out what else might be happening.

I am loading an array with ALAssets using the -enumerateAssetsUsingBlock method on ALAssetsGroup. When it completes, I am loading a custom image scroller. As the scroller finishes scrolling, I use NSInvocationOperations to load the images for the currently visible views (pages) from the photo library on disk. Once the image is loaded and is cached, it notifies the delegate which then grabs the image from the cache and displays it in an image view in the scroller.

Everything works fine, but the time it takes from when -setImage: actually gets called to the time it actually shows up visibly on the screen is unbearable–sometimes 10 seconds or more to actually show up.

I have tried it both with and without image resizing which adds almost nothing to the processing time when I do the resizing. As I said, the slowdown is somewhere after I call -setImage on the image view. Is anyone aware of some sort of aspect of the AssetLibrary API that might cause this?

Here’s some relevant code:

- (void)setImagesForVisiblePages;
{
  for (MomentImageView *page in visiblePages)
  {
    int index = [page index];
    ALAsset *asset = [photos objectAtIndex:index];

    UIImage *image = [assetImagesDictionary objectForKey:[self idForAsset:asset]];

    // If the image has already been cached, load it into the
    // image view. Otherwise, request the image be loaded from disk.
    if (image)
    {
      [[page imageView] setImage:image];
    }
    else {
      [self requestLoadImageForAsset:asset];      
      [[page imageView] setImage:nil];
    }
  }  
}
  • 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-15T20:08:53+00:00Added an answer on May 15, 2026 at 8:08 pm

    This will probably mess up any web searches looking to solve problems with the AssetsLibrary, so for that I apologize. It turns out that the problem wasn’t the AssetsLibrary at all, but rather my use of multi-threading. Once the image finished loading, I was posting a notification using the default NSNotificationCenter. It was posting it on the background thread which was then updating (or trying to update, at least) the UIImageView with -setImage. Once I changed it to use -performSelectorOnMainThread and had that selector set the image instead, all was well.

    Seems no matter how familiar I get with multi-threading, I still forget the little gotchas from time to time.

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

Sidebar

Related Questions

Normally I'm pretty competent with CSS but I just can't figure this one out...
I'm pretty confused by this one and can't think of anything obvious that I
Okay, I need help. I'm usually pretty good at SQL queries but this one
This one is pretty crazy: I've got an AppSight recording (for those not familiar,
I thought I had this one pretty good, but I just keep running into
This one has me pretty rattled so I thank you in advance for your
I've been pretty puzzled by this one. It seems as though my implementation of
Im still pretty new so bear with me on this one, my question(s) are
I'm reading this introductory book on parsing (which is pretty good btw) and one
This is a pretty odd situation I have here. I have used a piece

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.