Hello, I have started playing with core data and I am having trouble to get the attributed string from an NSTextView into my program.
In the project, the .xcdatamodel contains an Entity called 'signatures' which has a property named 'sigText'. I have set the type of sigText to Binary Data. In my .xib file, I have a NSScrollview containing an NSTextView. I have binded the NSTextView data to an object controller. The controller key is: selection; the model key path is 'sigText' and the value transformer is NSUnarchiveFromData. The application correctly saves and displays my data when I save/open documents. The trouble I have is to access the attributed string within my code to later draw in a custom view. I am trying something like this: NSManagedObjectContext *context = [self managedObjectContext]; NSManagedObjectModel *model = [self managedObjectModel]; NSDictionary *entities = [model entitiesByName]; NSEntityDescription *entity = [entities valueForKey:@"signatures"]; NSFetchRequest * fetch = [[NSFetchRequest alloc] init]; [fetch setEntity: entity]; NSArray *results = [context executeFetchRequest:fetch error:nil]; myData = [[results objectAtIndex:0] valueForKey:@"sigText"]; NSAttributedString *signatureView = (NSAttributedString *)[NSUnarchiver unarchiveObjectWithData:myData]; [mypreview lockFocus]; [signatureView drawAtPoint:myPoint]; [mypreview unlockFocus]; Obviously something is wrong since the text is not drawn and the console outputs: -[NSConcreteMutableData drawAtPoint:]: unrecognized selector sent to instance 0x114a3afb0 Any help with this would be very welcome! Regards, Bernard._______________________________________________ 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