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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:40:59+00:00 2026-06-12T08:40:59+00:00

I need some help for a problem which I can’t solve but I think

  • 0

I need some help for a problem which I can’t solve but I think I am close to the solution. Here is it:

In a version of my app, I was able to populate a tableview (in CellforRowAtIndexPath) with images taken from the Assetlibrary using the following 2 lines:

ALAsset someAsset = [theAssets objectAtIndex:indexPath.row];
[cell.imageView setImage:[UIImage imageWithCGImage:[someAsset thumbnail]]];

Now, I am trying to read image files from the directory and stored in an NSMutableArray. I can see the filenames when I NSLog the NSMutableArray. But how do I now cause the files to be converted into images and displayed in my tableview in the same way I did why using the Assetlibrary? I have tried several times, but the app either crashes or it does not show the image thumbnails in the table view. For example, this statement does not display the image but the app does not crash:

UIImage *anImage = [UIImage imageWithContentsOfFile:[self.listTable objectAtIndex:0]];

When I setImage in the next line, it doesn’t work. Someone please help!

UPDATED: The contents of self.listable when I NSLog it is something like this: “19-10-25 276-10-12.jpg”,
“19-10-37 276-10-12.jpg”,
“19-10-54 276-10-12.jpg”,
“19-10-65 276-10-12.mov”, etc.

When I NSLog my documents directory, it is: /var/mobile/Applications/8CB1368A-AAE2-4815-BD26-A7B7C8536193/Documents.

  • 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-12T08:41:00+00:00Added an answer on June 12, 2026 at 8:41 am

    Apps can only imageWithContentsOfFile for files located within the app’s sandbox (e.g. in Documents, the bundle, etc.) If these files are located in your Documents folder, you get the full path via:

    NSString *documentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    NSString *imageFullPath   = [documentsFolder stringByAppendingPathComponent:imageFilename];
    

    You can then use that in imageWithContentsOfFile.


    Update:

    You asked:

    my directoryContents is an NSArray; how do I convert it to NSString and then [documentsFolder stringByAppendingPathComponent ...] and store each fullpath in the NSMutableArray?

    You might do something like:

    NSFileManager *fileManager   = [NSFileManager defaultManager];
    NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    NSArray *filenames           = [fileManager contentsOfDirectoryAtPath:documentsDirectory error:nil];
    NSMutableArray *paths        = [[NSMutableArray alloc] initWithCapacity:[filenames count]];
    
    for (NSString *filename in filenames)
    {
        [paths addObject:[documentsDirectory stringByAppendingPathComponent:filename]];
    }
    
    NSLog(@"%s filenames = %@", __FUNCTION__, filenames);
    NSLog(@"%s paths = %@", __FUNCTION__, paths);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well i need some help here i don't know how to solve this problem.
I need some help in getting this right, problem Write a function which takes
I need some help with a small php problem. But i dont know how
Okay, I need some help here. This is the same old "can't use an
I need some help in picking the 'right' solution for the following 'problem'. I
i need some help with this problem. I have a binary tree stucture which
Need some help with this problem in implementing with XSLT, I had already implemented
I need some help in solving this problem. We have a large amount of
i got some problem and need help .. my plan : 1. get ip
ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have

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.