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 8905037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:17:24+00:00 2026-06-15T02:17:24+00:00

I am writing a multithreaded application which needs to upload photos from the ALAssetsLibrary

  • 0

I am writing a multithreaded application which needs to upload photos from the ALAssetsLibrary en masse in the background. So I have an NSOperation subclass which finds the appropriate ALAsset via the asset’s URL and adds the image to an upload queue.

In the upload queue for the current ALAsset, I need to get the metadata from the image, but I’ve encountered a problem: both the -metadata and the -fullResolutionImage methods never return when they are called on the ALAssetRepresentation of the ALAsset. They simply hang there indefinitely. I tried printing the value of each of these methods in LLDB, but it hung the debugger up, and I ended up killing Xcode, signal 9 style. These methods are being called on a background queue.

I am testing these on an iPad 2. This is the method in which the ALAsset is added to the upload queue when it is found in the success block of -assetForURL:resultBlock:failureBlock:

- (void)addMediaToUploadQueue:(ALAsset *)media {
    @autoreleasepool {
        ALAssetRepresentation *defaultRepresentation = [media defaultRepresentation];
        CGImageRef fullResolutionImage = [defaultRepresentation fullResolutionImage];

        // Return if the user is trying to upload an image which has already been uploaded
        CGFloat scale = [defaultRepresentation scale];
        UIImageOrientation orientation = [defaultRepresentation orientation];

        UIImage *i = [UIImage imageWithCGImage:fullResolutionImage scale:scale orientation:orientation];
        if (![self isImageUnique:i]) return;

        NSDictionary *imageDictionary = [self dictionaryForAsset:media withImage:i];

        dispatch_async(self.background_queue, ^{
            NSManagedObjectContext *ctx = [APPDELEGATE createManagedObjectContextForThread];
            [ctx setUndoManager:nil];

            [ctx performBlock:^{
                ImageEntity *newImage = [NSEntityDescription insertNewObjectForEntityForName:@"ImageEntity"
                                                                    inManagedObjectContext:ctx];

                [newImage updateWithDictionary:imageDictionary
                         inManagedObjectContext:ctx];

                [ctx save:nil];

                [APPDELEGATE saveContext];

                dispatch_async(dispatch_get_main_queue(), ^{
                    [self.fetchedResultsController performFetch:nil];
                });

                    if (!currentlyUploading) {
                        currentlyUploading = YES;
                        [self uploadImage:newImage];
                    }
            }];
        });
    }
}
  • 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-06-15T02:17:25+00:00Added an answer on June 15, 2026 at 2:17 am

    I had a similar problem and I was tearing my hair out trying to figure it out.

    Turns out while I had thought I setup a singleton for ALAssetsLibrary, my code was not calling it properly and some ALAssets were returning an empty ‘fullResolutionImage’

    In all of my NSLogs I must have missed the most important message from Xcode:

    “invalid attempt to access ALAssetPrivate past the lifetime of its owning ALAssetsLibrary”

    Follow this link

    http://www.daveoncode.com/2011/10/15/solve-xcode-error-invalid-attempt-to-access-alassetprivate-past-the-lifetime-of-its-owning-alassetslibrary/

    I hope that helps

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

Sidebar

Related Questions

I'm writing a multi threaded console application which downloads pdf files from the web
We have a WinForms desktop application, which is heavily multithreaded. 3 threads run with
I am writing a multithreaded socket application in Python using the socket module. the
I'm writing a multithreaded Java program where each thread potentially needs its standard output
I am writing a multi-threaded .Net application in which many callers need to concurrently
Here's the scenario: I have a multi threaded java web application which is running
I'm writing a multi-threaded application, where there is a main thread which distributes tasks
I'm writing a multithreaded program, which would crash when a particular exception was thrown.
I'm writing an application which processes a lot of xml files (>1000) with deep
I am developing a Math application which can be extended by writing python scripts.

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.