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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:18:37+00:00 2026-06-15T05:18:37+00:00

In my app i store images in my documents folder and store their URI

  • 0

In my app i store images in my documents folder and store their URI in the database.

Whenever i’m trying to load the image based on the URI stored in the db, i get “nil” back as a result.

The stored URI looks like this:

/Users/myname/Library/Application Support/iPhone
Simulator/6.0/Applications/78325CF9-73B0-4D0D-B136-FD8FF8D837C1/Documents/WC_45FEAF25-AC0C-4E91-A5E2-AA48215F1E48-3147-000005C6C9E65B42.jpg

When i look into it from iTerm i see that the image is there, but in iTerm i have to cd into the directory like this:

/Users/myname/Library/Application\ Support/iPhone\
Simulator/6.0/Applications/78325CF9-73B0-4D0D-B136-FD8FF8D837C1/Documents/WC_45FEAF25-AC0C-4E91-A5E2-AA48215F1E48-3147-000005C6C9E65B42.jpg

notice the backslashes before whitespaces

I’m trying to get the image using this function:

-(UIImage *) getImageFromURL:(NSString *)fileURL {
    UIImage * result;

    NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:fileURL]];
    result = [UIImage imageWithData:data];

    return result; //result is always nil
}

Is the problem related to the backslashes?
Any help is very much appreciated!

Sincerely,

Zoli

  • 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-15T05:18:38+00:00Added an answer on June 15, 2026 at 5:18 am

    The solution was to not store the uri in the database, only the image name. (But still store the image in the documents directory)
    Then with the following function the image can be retrieved:

    - (UIImage*)loadImageWithName:(NSString*) name
    {
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                             NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString* path = [documentsDirectory stringByAppendingPathComponent:
                          [NSString stringWithString: name] ];
        UIImage* image = [UIImage imageWithContentsOfFile:path];
        return image;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a App images stored in Document Directory Folder, I wanted Particular image display
I'm trying to use the app's Documents directory to store images, and later access
I'm developing an iOS app. I get collection of images from web, store them
I am trying to save some documents/Images and files in sqlite database . The
In my app I'm using an xml file to store some data, and images
I have an app that used GridFS to store the images of a document
I am designing an prototyping an app the needs to store images, similar to
Many apps already in App Store has ability to print from iphone without installing
Except Google's app store, there are Samsung app store, Amazon app store, etc... As
When submitting an app to the iOS App Store, one is required to declare

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.