• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [SOLVED] Drag & Drop Launch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED] Drag & Drop Launch


  • Subject: Re: [SOLVED] Drag & Drop Launch
  • From: Uli Kusterer <email@hidden>
  • Date: Thu, 8 Dec 2005 20:34:30 +0100


Am 08.12.2005 um 00:19 schrieb Kris Rambish:
1. You must make your target aware of document types it can open. Select your target from the groups & files pane, and get info. In the properties tab, toward the bottom, you will see a list of document types. For folders, you must add a line where the properties are set as follows:
- OS Types = fold

This is necessary to accept dropped folders.

- Store Type = Binary

This is only needed for CoreData-based files.

- Role = Editor
- Package = checked

"package" means whether your document is a bundle (i.e. a folder with a filename suffix containing other files, just like a framework, application or keynote presentation). So, in the case of folders or files, this should actually be turned off.

I would imagine you would add another line with info specific to your app and document type to open dropped documents. NOTE: if you are not seeing these options in the target inspector, you must upgrade your target (this confused me for a long time)... choose "Upgrade all targets in project to native" from the "Project" menu.

If you're using NSDocument (which you should if they are documents and your app isn't just a droplet-style utility like StuffIt Expander or DropZip), you'll just specify the name of your NSDocument subclass and override -readFromURL:ofType:error: to correctly handle the folder. For a bundle you'd use this, or even better the file wrapper variant, and for actual files, you'd probably want to use the NSData- based variant.

2. Your NSApp delegate must implement

- (BOOL)application:(NSApplication *)anApplication openFile: (NSString *)aFileName

This is the option to use if NSDocument doesn't make sense. You still have to add entries to your app's info.plist, but you can ignore the class name fields in the target inspector.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >[SOLVED] Drag & Drop Launch (From: email@hidden (Kris Rambish))

  • Prev by Date: Re: Sheets and NSThread
  • Next by Date: Re: What is the rationale behind keeping preferences in one place and "Application Support" files in another?
  • Previous by thread: [SOLVED] Drag & Drop Launch
  • Next by thread: Simple NSTextList Example
  • Index(es):
    • Date
    • Thread