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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:32:14+00:00 2026-06-09T19:32:14+00:00

I just moved from ASIHTTP to AFNetworking library. I am also using SDURLCache library

  • 0

I just moved from ASIHTTP to AFNetworking library. I am also using SDURLCache library from Olivier Poitrey and Peter Steinberg. I want to cache all the images that I gonna use in my application. For these, I tried this:

NSOperationQueue *queue = [[NSOperationQueue alloc] init];
        for(NSURLRequest *imageRequest in imageRequestArray){
            AFURLConnectionOperation *operation2 = [[[AFURLConnectionOperation alloc] initWithRequest:imageRequest] autorelease];
            [queue addOperation: operation2];
            [operation2 waitUntilFinished];
}

And when I need to show images, I am doing this for each image:

  NSURL *url = [NSURL URLWithString:[cat imagePath]];
        NSURLRequest *imageRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30.0];


        AFImageRequestOperation *operation = [AFImageRequestOperation imageRequestOperationWithRequest:imageRequest 
                                                                                  imageProcessingBlock:nil
                                                                                             cacheName:@"nscache"
                                                                                               success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image){
                                                                                                   //NSData *responseData = [request responseData];
                                                                                                   imageView.alpha = 0.0;
                                                                                                   [imageView setImage:image forState:UIControlStateNormal];
                                                                                                   [UIView beginAnimations:@"ToggleViews" context:nil];
                                                                                                   [UIView setAnimationDuration:1.0];                
                                                                                                   imageView.alpha = 1.0;
                                                                                                   [UIView commitAnimations];
                                                                                               }
                                                                                               failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){}
                                              ];
        [operation start];

After a while, application gives memory warning, then shuts down. For that, I did the following:

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
[[NSURLCache sharedURLCache] removeAllCachedResponses];
NSLog(@"Memory Warning...");
}

It clears the cache(what I don’t what) but after a while, application closes again.

What should I do for that?

  • 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-09T19:32:15+00:00Added an answer on June 9, 2026 at 7:32 pm

    The problem is likely caused because ARC doesn’t automatically get set up on queues or on background threads. I had the same issue and solved it with the following article:

    https://agilewarrior.wordpress.com/2012/04/09/memory-leaks-with-arc/

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

Sidebar

Related Questions

Ive just moved from VB.Net to C#. I dont understand why people are using
I have just moved from using php mvc frameworks to rails and have been
does anybody have experience with OmniAuth & Facbeook? I just moved from using a
Just moved from VS2010 Professional to Premium. When I hit a failing Assert using
I just moved my Wordpress site from using nginx to Apache2, and found that
I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major
So i have just moved everything from my localhost to a new online server
I've just moved over from shared to dedicated hosting, and suddenly POST is not
I have just moved a site from a dedicated server to a GoDaddy shared
We just moved over to Git from SVN. In trying to clean up some

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.