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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:17:55+00:00 2026-05-26T13:17:55+00:00

I write iOS app and use imageStore library to lazy load images and cache

  • 0

I write iOS app and use imageStore library to lazy load images and cache them in memory. (https://github.com/psychs/imagestore)

On ViewController I create imagestore instance:

imageStore = [ImageStore new];
imageStore.delegate = self;

When image loaded successfuly, imagestore call delegate method

- (void)imageStoreDidGetNewImage:(ImageStore*)sender url:(NSString*)url

that doing reloadData on tableview to redraw cells.
All works good. But there is the problem: if ViewController didUnload (go back in navigation controller) and image loaded, application finish with crash, because imagestore call method of unloaded ViewController.

I try to do following:
1) in ViewController I place this code in viewDidUnload section:

imageStore.delegate = nil;
imageStore = nil;

2) In imageStore I added checking for nil:

if(delegate != nil) {
  ...call delegate method
}

It works, but periodically app crash anyway.

  • 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-26T13:17:56+00:00Added an answer on May 26, 2026 at 1:17 pm

    Try putting this code on dealloc section.

    imageStore.delegate = nil;
    imageStore = nil;
    

    In the same way the if clause is not necessary because any call to an nil object is ignored by the application, so if you have something like this:

    id delegate = nil;    
    [delegate callAnyMethod];
    

    has no effect in your application behavior, in other hand if the call of the method delegate is optional you should asure that delegate responds to selector, something like this should do the trick:

    if([delegate conformsToProtocol:@protocol(yourProtocolName)] && [delegate respondsToSelector:@selector(imageStoreDidGetNewImage:url:)]) {
           [delegate imageStoreDidGetNewImage:imageStore url:url];
    }
    

    Cheers!

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

Sidebar

Related Questions

I write my app in VS 2008 and so use all the fanciful stuffs
I would like to write an html/javascript/sql app for personal use only running locally
Back Story: I was approached to write an app, but iOS isn't something that
I am trying to use a single /www folder to write a phonegap app
I want to write an iOS app that must download data from a website
I write the client app in iOS. I write the server side in WCF
I would like to write an app which can be run on iOS 3.1.3
I have a Rails app that has 2 clients -- an iOS app reads/writes
When I do fstream someFile(something.dat, ios::binary|ios::out); someFile.seekp(someLocation, ios::beg); someFile.write(someData, 100); It seems to replace
I'm trying to use C++ to write an entry in a specific place in

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.