• 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: Pulling NSURL off the pasteboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Pulling NSURL off the pasteboard (From: John Scalo <email@hidden>)

  • Prev by Date: Re: NSWorkspaceRecycleOperation and auto-renaming items moved to Trash
  • Next by Date: setState for NSMenuItems in Dock menu
  • Previous by thread: Pulling NSURL off the pasteboard
  • Next by thread: setState for NSMenuItems in Dock menu
  • Index(es):
    • Date
    • Thread