Pulling NSURL off the pasteboard
Pulling NSURL off the pasteboard
- Subject: Pulling NSURL off the pasteboard
- From: John Scalo <email@hidden>
- Date: Sun, 24 Feb 2002 15:33:21 -0800
Hi,
I'm trying to deal with drag & drop from the Finder by registering and
accepting NSURLPboardType. Everything works except I don't know how to get
the actual NSURL data. Here's what I'm trying:
---
- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>)info
row:(int)row dropOperation:(NSTableViewDropOperation)operation
{
NSURL *url = NULL;
NSData *urlData = NULL;
NSPasteboard * pboard = [info draggingPasteboard];
NSString *type = [pboard availableTypeFromArray: [NSArray
arrayWithObjects: NSURLPboardType, nil]];
if (!type)
return NO;
//always finds NSURLPboardType
urlData = [pboard dataForType: NSURLPboardType];
//urlData is non-nil here (good)
url = [NSUnarchiver unarchiveObjectWithData: urlData];
//url is always nil here (bad)
...
}
---
What is the proper way to get the NSURL if it's not with NSUnarchiver?
Thanks!
John
_______________________________________________
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.