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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:56:13+00:00 2026-05-26T10:56:13+00:00

In my iPhone app testing environment, I am reading in .png images from a

  • 0

In my iPhone app testing environment, I am reading in .png images from a folder called ChineseCharTest under the Resources folder of my project. I noticed that if I changed the contents of this folder to run a new test with different images, the old images were not being removed from the application memory. I’m trying to remove them each time the test is run so the images being read in are the most recent. Here is the code I am currently using:

NSError *err;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString* resources_path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/ChineseCharTest"];
NSArray *prev_test_contents = [fileManager contentsOfDirectoryAtPath:resources_path error:nil];  
NSEnumerator *e = [prev_test_contents objectEnumerator];
NSString *png_filename;
NSString *extension = @"png";
// Remove previous files with .png extension from ChineseCharTest folder
while ((png_filename = [e nextObject])) {
    if ([[png_filename pathExtension] isEqualToString:extension]) {
        BOOL success = [fileManager removeItemAtPath:[resources_path stringByAppendingPathComponent:png_filename] error:&err];
        if (!success) { 
            NSLog(@"Error removing file: %@", [err localizedDescription]);
        }
    }
}

The images from the previous run of the app are not being deleted. The error return on each attempt is the seemingly common Cocoa error 513: The operation couldn’t be completed. Does anyone know what I am doing wrong or another way of doing this?

Much 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-05-26T10:56:14+00:00Added an answer on May 26, 2026 at 10:56 am

    Files in your app’s bundle are read-only and any attempt to delete or modify them from iOS will fail.

    If you are actually talking about rebuilding your app with different image resources and you are finding that the old ones are still in the app bundle on your test device then you will need to clean your project, delete the app from your test device then re-install it.

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

Sidebar

Related Questions

After configuring my iPhone app for unit testing, I belatedly noticed this warning in
I'm currently building an iPhone app that will display data from an NSMutableArray called
I have been developing and testing an iPhone app under a family members Apple
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal
I'm testing a new iPhone app with my end-users and found that a lot
I'm currently creating an iPhone app and we need some testing with about 20~30
I am trying to push an app to a jailbroken iPhone for development testing.
My iPhone app generally uses under 5MB of living memory and even in the
My iphone app called Google Local Search(non javascript version) to behave some search business.
I am doing unit testing on my iPhone app using OCUnit on XCode 3.2.3,

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.