Re: NSOpenPanel and JPG files
Re: NSOpenPanel and JPG files
- Subject: Re: NSOpenPanel and JPG files
- From: "Louis C. Sacha" <email@hidden>
- Date: Mon, 26 Apr 2004 22:01:16 -0700
Hello...
I'm guessing that you are using Xcode and you have zerolink turned on...
You problem is probably that you have not linked to the AppKit
framework, so sending a message to NSImage is the same as sending a
message to nil. This would normally cause an error at compile time
(since the symbol for the NSImage class does not exist), but zerolink
will hide this problem from you.
You need to make sure that you have linked your project to the
Cocoa.framework (which includes AppKit as well as Foundation) instead
of just the Foundation.framework. You can add Frameworks to your
project by going to the "Project" menu and selecting the "Add
Frameworks..." menu item.
I'd recommend that you turn off zerolink as well, but that's just my
preference. It's kind of a pain to do it for all of your projects
since you need to change it in the build settings for all xcode
native targets in each of your existing projects, and also edit the
project templates since it is on by default for all new projects (at
least as of Xcode 1.1)...
Hope that helps,
Louis
Just keeping things simple, here is the code:
#import <Foundation/Foundation.h>
#import <AppKit/NSImage.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSArray * imageFileTypesList = [NSImage imageFileTypes];
NSLog(@"Image File Types: %@\n", imageFileTypesList);
[pool release];
return 0;
}
And this is what is output when the program is built and run:
2004-04-26 20:56:47.972 TestImage[1974] Image File Types: (null)
TestImage has exited with status 0.
Thanks,
Ryan
_______________________________________________
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.