On Oct 26, 2011, at 8:20 PM, GW Rodriguez <headtech...@yahoo.com> wrote:

>     if([[[info draggingPasteboard] types] containsObject:NSURLPboardType] ) {
>         NSString *availableType = [[info draggingPasteboard] 
> availableTypeFromArray:firstType];
>         NSString *fileType;
>         NSURL *url;
>         NSArray *filesList = [[info draggingPasteboard] 
> propertyListForType:availableType];

NSURL is not a property list type. You should use the new NSPasteboardReading 
API (available since 10.6), or if you need backwards compatibility with 10.5, 
use +[NSURL URLFromPasteboard:] declared in <AppKit/NSPasteboard.h>.

>         
>         for (int i=0; i<[filesList count]; ++i) {
>             url = [filesList objectAtIndex:i];
>             
>             if ([url getResourceValue:&fileType forKey:NSURLTypeIdentifierKey 
> error:NULL]) {

This will fail silently (fileType==nil, error==NULL) if the URL is not a 
file:// URL to an existing file on disk. -getResourceValue:forKey:error:, when 
given one of the file system resource keys, is really just a wrapper around 
other APIs like -[NSWorkspace typeOfFile:error:]. If someone has put an http:// 
URL on the pasteboard, you need to be ready to handle it.

--Kyle Sluder_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to