Zero Errors or warnings. No thumbs tho. simulator


#1

I check and rechecked. but No thumbnails.

Thumbnail is created. (check!)
But don’t see it homepwneritemCell. Which is getting called (check)

and I’m calling

to add the image / thumbnail created…

Is there a chance a simulator bug is causing it.
or Does it not work with selected from photo library.

Any other idea???
thanks
Ian


#2

Always obvious when you find it.

So as you can guess it wasn’t a simulator error.
But a messed up bracket. in Possessions.m

[code]- (UIImage *)thumbnail
{
// was this !!!
if (!thumbnailData) {
} return nil;

    // should have been this //
  • (UIImage *)thumbnail
    {
    // Am I imageless?
    if (!thumbnailData) {
    return nil;
    }

[/code]
So it was exiting before assigning.
Ugh ! well I guess learning to Debug is part of the process, painful but useful.
hope this helps someone else


#3

I got the same issue, but had a different problem (well, same problem in a different area). I was double releasing the thumbnail and not releasing the thumbnail data.

Was the following:

- (void)setThumbnail:(UIImage *)image
{
    [image retain];
    [thumbnail release];
    thumbnail = image;
}

    // Private setter
- (void)setThumbnailData:(NSData *)d
{
    [d retain];
    [thumbnail release]; // Typo here.
    thumbnailData = d;
}

Needed to be:

- (void)setThumbnail:(UIImage *)image
{
    [image retain];
    [thumbnail release];
    thumbnail = image;
}

    // Private setter
- (void)setThumbnailData:(NSData *)d
{
    [d retain];
    [thumbnailData release];  //Typo fixed
    thumbnailData = d;
}

#4

I do have a question for anyone out here that can clarify this for me:

In setThumbnailDataFromImage:

What is the purpose of these two lines of code:

    projectRect.origin.x =  (newRect.size.width - projectRect.size.width) / 2.0;
    projectRect.origin.y = (newRect.size.height - projectRect.size.height) / 2.0;

As I currently understand it:

[] newRect is ultimate size and used to establish size and rounded edges of the end result - origin at 0,0 (also used to calculate multiple or image resizing). I’m understanding this as an image “mask”.
[
] projectRect is where the image will be drawn to, not necessarily 40 x 40 square, size determined by multiplier. Origin is dynamic based on difference ratio of the original image and the thumbnail size (divided by 2).

I’m (incorrectly) assuming that the two origins need to be lined up such that when the image is extracted from the current context the newRect will line up with the projectRect and the image is the product of the two.

Obviously, I’m incorrect (as it works), just don’t understand how/why.

Thank you for any help.