Re: Pulling NSURL off the pasteboard
Re: Pulling NSURL off the pasteboard
- Subject: Re: Pulling NSURL off the pasteboard
- From: Hsu <email@hidden>
- Date: Sun, 24 Feb 2002 15:54:17 -0800
Why not just use:
NSURL *url = [NSURL URLFromPasteboard:[info draggingPasteboard]];
Karl
On Sunday, February 24, 2002, at 03:33 PM, John Scalo wrote:
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.
--
The reasons angels can fly is because they take themselves so lightly.
Homepage:
http://homepage.mac.com/khsu/index.html
_______________________________________________
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.