Error initializing an NSImage
Error initializing an NSImage
- Subject: Error initializing an NSImage
- From: Hisaoki Nishida <email@hidden>
- Date: Sat, 1 Mar 2003 05:42:14 -0500
I am trying to initialize an image, that's all I'm doing.
But for some reason it fails, my NSAssert saying that filePath is nil.
The bundle printed in NSLog as "NSBundle
</Users/hisaokin/Desktop/MyApp/build/MyApp.app> (loaded)"
newFile is valid. It's the name of the file without the extension, and
it exists in a folder called Resources in my project folder. The
extension is ".tiff". I tried with many TIFF images, same result. How
could the filePath be nil? it's really puzzling me.
Here's the code:
NSBundle * mainBundle = [NSBundle mainBundle];
NSString * filePath = [mainBundle pathForResource:newFile
ofType:@"tiff"];
NSImage * image = [[[NSImage alloc]
initWithContentsOfFile:[filePath stringByExpandingTildeInPath]]
autorelease];
Rather simple..
Any help appreciated!
Thanks,
-yuki
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.