0

I register my app with:

NSString *self_id=[[NSBundle mainBundle] bundleIdentifier];

CFStringRef cfString;

cfString = UTTypeCreatePreferredIdentifierForTag(
                                                 kUTTagClassFilenameExtension,
                                                 CFSTR("fdp"),
                                                 kUTTypeData);

OSStatus a = LSSetDefaultRoleHandlerForContentType((CFStringRef)cfString,kLSRolesViewer,(CFStringRef)self_id);    

But on the other side, how can i get the filename the finder send to my app? what the mechanism should i set for getting the filename? Is there any document about this problem?

Justin Boo
  • 10,132
  • 8
  • 50
  • 71

1 Answers1

0

If your application is document-based, the document controller will create a document object for each opened file automatically. You don't need to do anything at run time to handle the files; just implement your document class and declare the right things in your Info.plist, as described in Document-Based Applications Overview.

If your application is not document-based, you need to create an object to be the delegate of the application object. In that object, respond to the application:openFiles: message.

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370