CoreData and NSPasteboard for
CoreData and NSPasteboard for
Folks;
Since NSManagedObject doesn't implement NSCcoding whats the best way
to use the pasteboard for handling CoreData objects?
I've subclassed NSTableView to get some custom row handling, now I
want to add some drag and drop between two windows.
Sooo obviously:
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows
toPasteboard:(NSPasteboard*)pboard {
NSArray *typesArray = [NSArray
arrayWithObject:@"myCustomDragDropPboardType"];
[pboard declareTypes:typesArray owner:self];
NSMutableArray *entitiesToCopy = [NSMutableArray
arrayWithCapacity:[rows count]];
NSEnumerator *rowEnum = [rows objectEnumerator];
NSData *myPBoardData;
NSNumber * ix = [NSNumber numberWithInt:0];
while ( (ix = [rowEnumerator nextObject]) ) {
[entitiesToCopy addObject:[[self arrangedObjects]
objectAtIndex:[ix intValue]]];
}
myPBoardData = [NSKeyedArchiver archivedDataWithRootObject:
entitiesToCopy];
return YES;
}
--> 2006-01-18 18:24:09.079 appX[15676] *** -[myCoreDataEntity
encodeWithCoder:]: selector not recognized [self = 0x3af9960]
On the other hand, if I try the old school way
[pboard setPropertyList:entitiesToCopy
forType:@"myCustomDragDropPboardType"];
I get a empty result for proptryList:forType? Huh?
I've poked around the archives of cocoa-dev and cocoaBuilder but darn
if I can find anything on this point!
Any thoughts would be really appreciated!
Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden