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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:50:52+00:00 2026-06-14T12:50:52+00:00

Got an UIIMagePickerController in my newPlayerVC that saves an thumbnail image (after I resized

  • 0

Got an UIIMagePickerController in my “newPlayerVC” that saves an thumbnail image (after I resized it down to 100×100 px) to the AssetLibrary without any problems.

Dirrectly after saving the image I put in another call to the AssetLibrary again to fetch the just saved image to show the user (and also check that it works ok). That call looks like this;

// Display new thumbnail via AssetLIbrary call
    __block UIImage *_image = nil;
    [assetLib assetForURL:(playerImageURL)
              resultBlock:^(ALAsset *asset) {
                  _image = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]];
                  NSLog(@"Got the asset thumbnail, %@",_image);
                  [playerImageButton setImage:_image forState:UIControlStateNormal];
              }

             failureBlock:^(NSError *error) {
                 NSLog(@"Asset (image) fetch failed because %@",error);
             }];

So far it works just fine.
The terminal confirm logs with: “p.playerImage = assets-library://asset/asset.JPG?id=A79242D5-BC91-490B-BC37-0A9F529675EE&ext=JPG” and “Got the asset thumbnail, UIImage: 0xcb5b8a0” – so I know it’s getting the image from the asset library.

But then I try to do a very simular call from my “playerTableVC” to populate a tableview with that earlier saved image to an UIView in my custom cell – it just dont work (the custom cell is ok and wok with static images). Also I get no errors or warnings either from Xcode. That code looks like this from the function “- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath”;

// Set up Asset library
ALAssetsLibrary *assetLib = [[ALAssetsLibrary alloc]init];

__block UIImage *_image = nil;
[assetLib assetForURL:[NSURL URLWithString:p.playerImage]
          resultBlock:^(ALAsset *asset) {
              _image = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullResolutionImage]];
              NSLog(@"Got the asset thumbnail, %@", _image);
          }

 failureBlock:^(NSError *error) {
     NSLog(@"Asset fetch failed: %@",error);
 }];

// If no cell, create new
if (cell == nil) {
    cell = [[CellPlayer alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}

// If cell present, assign values
NSLog(@"p.playerImage = %@", p.playerImage);  // Check = ok

// Check if imageurl is empty = default image else the user choosen image
if ([p.playerImage isEqualToString:@""]) {
    cell.cellPlayerIcon.image = [UIImage imageNamed:@"defaultImageFrame_114x114"];
    // Add sortingorder ("player position") to tableview
    cell.cellPlayerStarIcon.text = [NSString stringWithFormat:@"%i", (indexPath.row +1)];
} else {
    cell.cellPlayerIcon.image = _image;  // = NO IMAGE IN CELL?
    // Add sortingorder ("player position") to tableview
    cell.cellPlayerStarIcon.text = [NSString stringWithFormat:@"%i.", (indexPath.row +1)];
}

cell.cellPlayerName.text = p.playerName;
cell.cellPlayerTime.text = p.playerTime;
cell.cellPlayerTimestamp.text = [NSString stringWithFormat:@"%@", p.playerTimeStamp];  // @"2012-10-01 @ 8:06";

return cell;

}

I belive I doing something wrong with the setting of the UIIMage in populating the cell above. Everything else works ok an also with a static UIImage. Tried a lot of variations of this and believe I know finally gone “code-flind”… 😉

Got any solutions, tips, pointers etc? Thanks 🙂

  • 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-14T12:50:53+00:00Added an answer on June 14, 2026 at 12:50 pm

    SOLVED!

    Turns out that the block did not retain the image in the above “_image”-variable. Simply solved with passing “_image” to a local variable like UIImage “myImage” within the block to retain it. It now works just fine and my cells get their images from the asset library as expected 🙂

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

Sidebar

Related Questions

got some problems. Built an applet that has to be used step-by-step. After each
I've got a simple UIImagePickerController which tries to grab the original selected image: if
I have a URL for an image (got it from UIImagePickerController) but I no
I've got a UIImagePickerController letting the user pick an image out of the image
Got a homework assignment that is giving me problems.... Its modifying a JSF project
Got a problem with Apache and PHP-files of Wordpress. When I go to any
Got a seg fault from my memcpy that gdb can't give me anything else
I have the same problem as the guy here: UIImagePickerController reloads view after its
I'm creating an image Based app and I want the images that are displayed
How can I get the creationdate of the movie that i got through the

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.