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

  • Home
  • SEARCH
  • 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 7579789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:45:29+00:00 2026-05-30T17:45:29+00:00

Scroll down to EDIT 1. This top bit is irrelevant now. This is my

  • 0

Scroll down to EDIT 1. This top bit is irrelevant now.

This is my code:

NSMutableDictionary *dictionary = [self.media objectAtIndex:index];
    NSLog(@"dictionary: %@", dictionary);
    NSString *originalImagePath = [dictionary objectForKey:@"OriginalImage"];
    NSLog(@"path: %@", originalImagePath);
    UIImage *originalImage = [UIImage imageWithContentsOfFile:originalImagePath];
    NSLog(@"original image: %@", originalImage);
    return originalImage;

And my NSLog:

dictionary: {
    IsInPhotoLibrary = 1;
    MediaType = 0;
    OriginalImage = "/var/mobile/Applications/5E25F369-9E05-4345-A0A2-381EDB3321B8/Documents/Images/E9904811-B463-4374-BD95-4AD472DC71A6.jpg";
}
path: /var/mobile/Applications/5E25F369-9E05-4345-A0A2-381EDB3321B8/Documents/Images/E9904811-B463-4374-BD95-4AD472DC71A6.jpg
original image: (null)

Any ideas why this might be coming out as null, despite everything appearing to be in place?

EDIT:

This is the code to write the image to file:

+(NSString *)writeImageToFile:(UIImage *)image {
    NSData *fullImageData = UIImageJPEGRepresentation(image, 1.0f);

NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Images/"];
NSString *name = [NSString stringWithFormat:@"%@.jpg", [JEntry generateUuidString]];
NSString *filePath = [path stringByAppendingPathComponent:name];
[fullImageData writeToFile:filePath atomically:YES];
NSLog(@"original image 2: %@", [UIImage imageWithContentsOfFile:filePath]);
}

This NSLog also comes out as null. So the problem lies here, most likely. Any ideas?

EDIT 2:

So, back-tracing even more now, and I’ve realised that it’s because this fails:

[fullImageData writeToFile:filePath atomically:YES];

You can return a bool on that line, telling if it was successful or not, and it’s returning NO for me. Any ideas why this might be?

EDIT 3:

The image that gets passed in is NULL. Trying to figure out where that’s gone wrong now.

  • 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-05-30T17:45:30+00:00Added an answer on May 30, 2026 at 5:45 pm

    Almost certainly your file does not exist. Modify your code as follows to log if a file exists or not:

    NSString *originalImagePath = [dictionary objectForKey:@"OriginalImage"];
    NSLog(@"path: %@", originalImagePath);
    BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:originalImagePath];
    NSLog(@"file exists: %d", fileExists);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take a look at the this link . Scroll down a bit and you
If you scroll down to the section 'Writing to Files and URLs' at this
I've seen this weird behavior on several sites recently: I scroll down a page
Today I read that there is a software called WinCalibra (scroll a bit down)
I saw this the other day (scroll all the way down to see some
With reference to this programming game I am currently building. Important: Scroll down to
(Scroll down to bottom of post to find solution.) Got a asp.net page which
Is it possible to scroll down the left and right parts of a vertically
When you scroll down to the bottom of http://www.dzone.com/links/ it automatically loads more links.
What I want to do is scroll down the window when I expand elements

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.