Cocoa Drag and Drop, reading back the data?

Dragged Types Dragged types are just strings that define a system pasteboard type (like NSFilenamesPboardType) or your app's own internal type (like "MyWidgetIdentifierType" to identify a widget by some internal ID). A drag type of "PDF" doesn't get you anything. You might as well call it "Bob8374Type" ... if you don't give your app the ability to recognize the type (or nothing ever puts anything into the pasteboard for that type), it's utterly useless.

You're working with dragged files, so NSFilenamesPboardType is correct. NSPasteboardTypePDF won't help you unless there is NSPasteboardTypePDF data on the pasteboard. When files are dragged, you get NSFilenamesPboardType.

Doesn't matter if the file is . Pdf or . Xyz; you're only getting paths.

Copy the File or Store a Path You need to decide whether you intend to copy the dropped PDF or just store a path (or better yet, file system reference) to it. If you're going to copy the PDF, you'll need to make sure you're aware of the proper storage locations (like the Application Support folder, etc). Assuming you really do want to copy the dropped pdfs somewhere, you don't need the PDF data.

You can use NSFileManager to copy (or move) the file at the given path to a new location. If you have some other storage mechanism (ie, you want to suck the PDF data of the file into some other data structure), you can just get the PDF data directly using NSData's +dataWithContentsOfURL:options:error: and do with its data what you please.

Really helpful. Thanks for clearing that up. I really appreciate it.

– kodai Jun 8 '10 at 6:41.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions