question about Apple's example code - LazyTableImages

Discussion in 'iOS Programming' started by Howiieque, Mar 27, 2010.

  1. Howiieque macrumors regular

    Feb 1, 2009
    hello everybody,
    i have got two questions about LazyTableImages(namely RootViewController.m) by Apple

    - (void)appImageDidLoad:(NSIndexPath *)indexPath {
    1. there is a condition test to verify whether the iconDownloader is not nil. but i think it is exactly that the iconDownloader with corresponding index path calls back this method, so it would not nil.

    2. once this method is called, it means that iconDownloader finishes its job. so i think iconDownloader can be release now and be removed from the imageDownloadsInProgress(mutable dictionary). as the name implies, the dictionary should only store the downloader in progress. and for memories' sake, the finishing downloader should also be removed.

    - (void)startIconDownload:(AppRecord *)appRecord forIndexPath:(NSIndexPath *)indexPath {
    in this method, there also a condition if to test whether the downloader exists. if it has already existed, it would get ignored. let us suppose that one iconDownloader encounters error and never gets released(it seems that the downloaders will not be released in the sample code). so when this method gets called for the second time with the same index path, it will do nothing. so it means once the download for one icon encounters error, it will not has a chance to get it later.

    Apple has so many experienced programmers, and it is very likely that i did not fully understand this example. would somebody answer my questions, please?
  2. Howiieque thread starter macrumors regular

    Feb 1, 2009
    and i also found out that if the app receive memory warning, it will crash.
  3. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Feel free to ask questions then, okay? I see plenty of statements and concerns in your post, but the only actual question was at the very end.
  4. rdowty macrumors 6502a


    Oct 5, 2008
    Did you ever figure this out. I think I'm having the same problem with the imageDownloadsInProgress not releasing finished IconDownloaders
  5. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    I'm using another library for downloading images Async in a UITableView. So if anyone intrested. let me know :)

Share This Page