• 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: Strings mangled on generalPasteboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strings mangled on generalPasteboard


  • Subject: Re: Strings mangled on generalPasteboard
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 23 Nov 2009 16:26:46 -0800

On Nov 23, 2009, at 4:16 PM, Kevin Walzer wrote:

> Does this address the problem of only one NSURL being returned?

No. But BTW I looked at your code again and I see why it's failing to get the paths.

>  for (NSString *type in types) {
>    //string type
>    if ([type isEqualToString:NSStringPboardType]) {
>      pasteboardvalue = [dragpasteboard stringForType:NSStringPboardType];
>      //URL; convert to string
>    } else if ([type isEqualToString:NSURLPboardType]) {
>      pasteboardvalue =  [[NSURL URLFromPasteboard:dragpasteboard] absoluteString];

You're looping over all the types on the drag pasteboard, and every time you stuff your resulting 'pasteboardvalue' string into the general pasteboard. Since each iteration overwrites the result of the previous ones, you only end up handling the last type on the pasteboard. I'm not sure exactly what your code is intending to do, but you need to restructure it somehow.

The thing that tends to make the most sense usually is not to loop but to ask the pasteboard for the data for each type you're interested in, the best type first, and then use the first type you get. So in your case you'd probably ask for filenames first, then URLs, then strings.

—Jens_______________________________________________

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

  • Follow-Ups:
    • Re: Strings mangled on generalPasteboard
      • From: Kevin Walzer <email@hidden>
References: 
 >Strings mangled on generalPasteboard (From: Kevin Walzer <email@hidden>)
 >Re: Strings mangled on generalPasteboard (From: Jens Alfke <email@hidden>)
 >Re: Strings mangled on generalPasteboard (From: Kevin Walzer <email@hidden>)
 >Re: Strings mangled on generalPasteboard (From: Jens Alfke <email@hidden>)
 >Re: Strings mangled on generalPasteboard (From: Kevin Walzer <email@hidden>)

  • Prev by Date: Re: Strings mangled on generalPasteboard
  • Next by Date: EXC_BAD_ACCESS when calling NSOpenPanel
  • Previous by thread: Re: Strings mangled on generalPasteboard
  • Next by thread: Re: Strings mangled on generalPasteboard
  • Index(es):
    • Date
    • Thread