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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:17:03+00:00 2026-05-13T18:17:03+00:00

The app that I am creating uploads images in four(the fourth is a test

  • 0

The app that I am creating uploads images in four(the fourth is a test function) ways;

1.Directly from UIImagePickerController with UIImagePickerControllerSourceTypeCamera like this:

//didFinishPickingImage method
if ([picker sourceType] == UIImagePickerControllerSourceTypeCamera)
{
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
}

CGRect myImageRect = CGRectMake(30.0f, 190.0f, 250.0f, 210.0f); 
myImage = [[UIImageView alloc] initWithFrame:myImageRect];
//released in dealloc because I reuse it alot

myImage.image = img;
[self.view addSubview:myImage]; 

2.Directly picking from photo library also using

myImage.image = img;

3.Using the image saved from 1.

pathFile = @"/private/var/mobile/Media/DCIM/100APPLE/"; 
NSString *ImagePath = [pathFile stringByAppendingString:imageFileName];
NSData *imageDataFile = [NSData dataWithContentsOfFile:ImagePath];  

UIImage *img = [UIImage imageWithContentsOfFile:ImagePath];

myImage.image = img;

4.As a test function: Using an image taken with the iPhone default camera app (same as UIImagePickerController) but using ImagePath instead of UIImagepickerController, UIImagePickerControllerSourceTypePhotoLibrary.

//Same as Number 3.
pathFile = @"/private/var/mobile/Media/DCIM/100APPLE/"; 
NSString *ImagePath = [pathFile stringByAppendingString:imageFileName];
NSData *imageDataFile = [NSData dataWithContentsOfFile:ImagePath];  

UIImage *img = [UIImage imageWithContentsOfFile:ImagePath];

myImage.image = img; 

*Up to here, the user can see the file in any of the four ways on the screen added to myImage instance of UIImageView(Depending on the user selection). This proves that I am selecting the right files(for three and four).

//uploading function

NSData *imageData = UIImageJPEGRepresentation(myImage.image, 1.0);


NSMutableURLRequest *request2 = [[[NSMutableURLRequest alloc] init] autorelease];
            [request2 setURL:[NSURL URLWithString:urlString]];
            [request2 setHTTPMethod:@"POST"];

NSMutableData *body = [NSMutableData data];
//... append boundary, content-disposition code etc here.
[body appendData:[NSData dataWithData:imageData]];
[request setHTTPBody:body];

The problem is that, on upload, number 1,2 and 4 work, NUMBER 3 DOESN’T.

Console output;
Program received signal: “EXC_BAD_ACCESS”

I am aware that this output stems from attempted access from released objects, and I have run into and solved this problem in other situations. But found no way here yet, even after counterchecking my memory allocations.

I would REALLY appreciate ways to solve this issue.

  • 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-13T18:17:03+00:00Added an answer on May 13, 2026 at 6:17 pm

    iPhone OS had created another folder “/private/var/mobile/Media/DCIM/101APPLE/” different from the default 100APPLE.

    I realized that actually sometimes the photos are also saved in a folder 999APPLE, 102APPLE etc. This depends on how you delete, copy and create photos in the Camera Roll.

    So your Camera Roll pictures could actually be stored in many different folders.

    Therefore, not being able to execute [NSData dataWithContentsOfFile:ImagePath];, it throws exception:

    “EXC_BAD_ACCESS”

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

Sidebar

Related Questions

I am creating app that download 4-5 images from server and display as gallery.
I am creating a small console app that needs a progress bar. Something like...
I'm creating an app that displays a random word (a key from an NSDictionary)
I’m currently creating an iOS app that uploads files to a server. As multiple
I have an upload phone app that uploads either images or audio recordings. The
I am creating a school management system that handles file uploads and downloads from
I'm creating an app that needs to be accessed by both a web front
We are creating an app that uses modules which are dynamically loaded into the
I'm creating and app that will rely on a database, and I have all
I am creating an app that is having a UIWebView which contains an advert.

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.