Invariably happens.  I hesitate and agonize over whether to hit the ³send²
button, then promptly discover the solution.  Apparently, I need to be using
³canReadItemWithDataConformingTpTypes² instead.  However, it is still a
mystery to me as to why the other failed.


On 6/20/12 12:28 PM, "Gordon Apple" <[email protected]> wrote:

> 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 protected])

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

This email sent to [email protected]

Reply via email to