I'm trying to copy NSManagedObjects using -dictionaryWithValuesForKeys and
-setValuesForKeysWithDictionary:. Some of my attributes are C++ objects (simple
ones). For example:
class
Rect : public CGRect
{
};
@interface
MyObj : NSManagedObject
@property (nonatomic, assign) Rect bounds;
@end
When I get the dictionary of values from the source object, I get something
reasonable:
(lldb) po values
(NSDictionary *) $0 = 0x0000000400770ae0 {
bounds = "<00000000 000030c0 00000000 000038c0 00000000 00004040 00000000
00004640>";
}
But when I try to set the values in the target object, my setBounds: method
- (void)
setBounds: (Graphics::Rect) inVal
{
NSString* v = NSStringFromRect(NSRectFromCGRect(inVal));
[self willChangeValueForKey:@"bounds"];
self.shadowBounds = v;
[self didChangeValueForKey:@"bounds"];
}
gets called with
inVal = (Rect &) 0x0000000000000000
> CGRect (CGRect)
Showing in the debugger. That is, the type of inVal is a Rect reference (Rect&).
Something's clearly not right. Can I even do this?
Thanks,
--
Rick
_______________________________________________
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]