• 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
NSPasteboardItem issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPasteboardItem issues


  • Subject: NSPasteboardItem issues
  • From: Gordon Apple <email@hidden>
  • Date: Wed, 20 Jun 2012 12:28:31 -0500
  • Thread-topic: NSPasteboardItem issues

I'm trying to convert code to use the new pasteboard methods, and having a
few issues.  For private types, I need to use NSPasteboardItem because the
read/write protocols don't work for managed objects.  (readObjects
automatically uses NSKeyedUnarchiver and I use a subclass to provide the
moc.)  The following claims success in writing to the general pasteboard,
but the paste handler is not seeing the NSPasteboardItem.  The property list
is an array of data.

//    Copy
- (void) putShapes:(NSArray*)shapes ontoPasteboard:(NSPasteboard*)pboard {
    [pboard clearContents];
    NSPasteboardItem *pbItem = [[NSPasteboardItem alloc] init];
    [pbItem setPropertyList:[self propListForShapes:shapes]
forType:RTPShapesType];
    NSArray *objArray = [NSArray arrayWithObject:pbItem];
    BOOL success = [pboard writeObjects:objArray];
    //  success = YES;
}

//    Paste
    classArray = [NSArray arrayWithObject:[NSPasteboardItem class]];
    if([pboard canReadObjectForClasses:classArray options:dict]) {
    //    This fails.  *dict = [NSDictionary dictionary]

Is there anything obvious I'm missing?

Another question -- Dragging in a color chip provides both an NSColor and an
NSPasteboardItem.  Given the first, what use is the latter?

_______________________________________________

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: NSPasteboardItem issues
      • From: Gordon Apple <email@hidden>
  • Prev by Date: Fwd: SBSendMail
  • Next by Date: Re: ARC and CFType release callback
  • Previous by thread: Re: Intercepting spawned URL requests from UIWebView and caching the response
  • Next by thread: Re: NSPasteboardItem issues
  • Index(es):
    • Date
    • Thread