I’ve got an NSData object that supposedly contains image data in the TIFF format. Here is an example of the output (in the top-left box).
However, when I NSLog it out, I get the following:
<NSImage 0x10013f620 Size={200, 200} Reps=(
"NSBitmapImageRep 0x1001220d0 Size={200, 200} ColorSpace=(not yet loaded) BPS=8 BPP=(not yet loaded) Pixels=200x200 Alpha=NO Planar=NO Format=(not yet loaded) CurrentBacking=nil (faulting) CGImageSource=0x100150070"
)>
Which makes me thing it might actually be a BitmapImage.
Anyways, when I do the following:
NSData *artworkData;
NSImage *image;
artworkData = [self.currentTrack artwork]; // actually sets memory, like expected
image = [[NSImage alloc] initWithData:artworkData]; // causes the error
I get this error:
2012-12-03 02:39:56.263 test[92556:303] -[NSImage length]: unrecognized selector sent to instance 0x10064ec90
2012-12-03 02:39:56.264 test[92556:303] -[NSImage length]: unrecognized selector sent to instance 0x10064ec90
Any ideas? This has been bothering me for quite a while now.
Thank you!
Are you sure you are dealing with an
NSDataobject? The object in your log output is no data, it’s already an NSImage. Therefore, trying to use it as an argument for-[NSImage initWithData:]will fail.