At least for a Cocoa (desktop) app, you'd want to add the following information to your application's Info.plist.
http://www.markdouma.com/developer/nacho.plist
Obviously, you should change the uniform type identifier to something appropriate. (I usually do com.markdouma.something, since that's my website).
Note that you only want to specify an entry for NSDocumentClass if you plan on using Cocoa's NSDocument architecture by creating an NSDocument subclass to handle loading the files. Otherwise, you could always just implement the following < NSApplicationDelegate > (read that as application delegate protocol) method:
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames;
That will give you an NSArray of NSStrings representing the POSIX paths to the files the user double-clicked on in the Finder (or dragged to the app icon, etc.)
If you want to go the NSDocument route, you can override the following method of NSDocument
- (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)type error:(NSError **)outError;
and create your dictionary with [[NSDictionary dictionaryWithContentsOfFile:[url path]] retain];
Hope this helps...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…