Re: Accepting files dragged from iTunes in a Cocoa app
Re: Accepting files dragged from iTunes in a Cocoa app
- Subject: Re: Accepting files dragged from iTunes in a Cocoa app
- From: "Stephen F. Booth" <email@hidden>
- Date: Wed, 10 Sep 2008 16:55:04 -0700
Stefan,
I use the following code to get the URLs from dragged files from iTunes:
NSString * const iTunesPboardType = @"CorePasteboardFlavorType 0x6974756E";
// Handle iTunes drops
else if([bestType isEqualToString:iTunesPboardType]) {
NSDictionary *iTunesDictionary = [[info draggingPasteboard]
propertyListForType:iTunesPboardType];
NSArray *tracks = [iTunesDictionary valueForKey:@"Tracks"];
NSEnumerator *enumerator = [tracks objectEnumerator];
NSDictionary *track = nil;
NSURL *url = nil;
while((track = [enumerator nextObject])) {
url = [NSURL URLWithString:[track valueForKey:@"Location"]];
if([url isFileURL])
; // Do something with URL
}
}
Stephen
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden