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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:45:23+00:00 2026-06-15T14:45:23+00:00

I have a value that I’m retrieving from a block that I’d like to

  • 0

I have a value that I’m retrieving from a block that I’d like to return in the below method. Being that it appears the block is asynchronous, how can I accomplish this?

-(UIImage*) imageAtIndex:(NSUInteger)index
{
    UIImage *image;
    [self.album enumerateAssetsAtIndexes:[NSIndexSet indexSetWithIndex:index] options:0 usingBlock: ^(ALAsset *result, NSUInteger index, BOOL *stop)
     {
            //set image in here
     }];

    return image;
}
  • 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-15T14:45:24+00:00Added an answer on June 15, 2026 at 2:45 pm

    I had done it like this in the past, check it.

    -(void) imageAtIndex:(NSUInteger)index //since block is async you may not be able to return the image from this method
    {
    
        UIImage *image;
        [self.album enumerateAssetsAtIndexes:[NSIndexSet indexSetWithIndex:index] options:0 usingBlock: ^(ALAsset *result, NSUInteger index, BOOL *stop)
         {
             //set image in here
              dispatch_async(dispatch_get_main_queue(), ^{ //if UI operations are done using this image, it is better to be in the main queue, or else you may not need the main queue.
                 [self passImage:image]; //do the rest of the things in `passImage:` method
              });
         }];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Math - mapping numbers I have value x that can be from
I have a Timestamp value that comes from my application. The user can be
I have a TDateTime value (that I get as result from EndOfTheMonth(date) ) to
I'm creating an abstract class to derive from. I have a Value property that
i have a value that name is brands and like this : $brands =
When using Python is it possible that a dict can have a value that
I have a value that's defined in application.ini conditions.time= 50 How can I read
12344-23s2$4 I have a value that I receive from the feed 12344-23s2$4, 12344-23s2$5, 12344-23s2$6,
I have a string value that is returned from the database. the value will
I have a value that increases by 1 every 5 views. The MySQL table

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.