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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:48:37+00:00 2026-06-09T22:48:37+00:00

I am attempting to create an application that goes through various images from the

  • 0

I am attempting to create an application that goes through various images from the net and aim to cache them onto the iPhone for offline use. The code I am currently working with is:

NSMutableDictionary *Cache;
- (UIImage *)CachedImage: (NSString*)url {
    UIImage *image = [Cache objectForKey:url];
if (image == nil) {
    image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]];
    [Cache setObject:image forKey:url];
    //NSLog (@"Stored");
    return image;
} else {
    //NSLog (@"Taken");
    return image;
} }

I call the function and place the image into an ImageView using the strip of code below.

    [self.imageView setImage:[self CachedImage:url]]; // Change url to desired URL.

Using the NSLog, the problem I found is that the code doesn’t actually store the value because the value is always reading nil. Why is that and are there other ways of storing images for offline use?
Thanks in advance.

-Gon

  • 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-09T22:48:39+00:00Added an answer on June 9, 2026 at 10:48 pm

    Use NSCache to cache UIImages. You can also save the image locally (if you reuse these images a lot and during multiple launch) so whenever your app closes or you flush your cache, you can get the images immediately from your local directory.

    https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSCache_Class/Reference/Reference.html

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

Sidebar

Related Questions

I am attempting to create/deploy an application onto the Redhat OpenShift Express platform, and
I am attempting to write a VB.net application which will allow users to create
I am attempting to create an application that will initiate a call to a
What I am attempting to do is create an application that adds effects to
I'm attempting to create a web application with TweetSharp that will connect to Twitter
I am attempting to create a simple application using Eclipse GEF that displays a
I'm attempting to create themeing system for my asp.net mvc application. I was able
I am attempting to create an application that requires a TFS server URL. The
I am attempting to create an application that will call a remote modem and
I am attempting to create a 3 tab iPhone Application with UITableViews on 2

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.