Thumbnail Gone After Save and Reload


#1

This is kind of weird. If I give something an image, and then save (by hitting the home button), then come back into the Homepwner app, the thumbnail is gone even though the item still has an image in the detail view. I looked into the thumbnail getter method on my item class and it still has the thumbnailData, and even though it is exactly the same as it was before, it gets (null) for the UIImage when it does [UIImage imageWithData:thumbnailData];

I suspect this has something to do with how the thumbnailData gets saved/encoded, but I’m doing it as the book directs. Help appreciated. Thank you.


#2

Same thing is happening to me. Anyone have an answer?


#3

Here’s what I did to solve the issue… Since opening up my items.archive file in my simulator documents folder showed that it did in fact contain my thumbnailData, I figured when ending the program that the the actual image thumbnails “cached” were being lost and is why the thumbnails where not being loaded so I chaged my code in ItemsViewController.m tableView:cellForRowAtIndex to “create” the image from the data in my items.archive instead of the actual thumbnail.

origional code in ItemsViewController.m tableView:cellForRowAtIndex:

my new code in ItemsViewController.m tableView:cellForRowAtIndex:

Anyone have a better suggestion?


#4

I have found some material left out with this chapter. You may want to cross-check against the sample code for the book. There is missing load code that wasn’t present in the text.