• 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
Re: -[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes


  • Subject: Re: -[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes
  • From: Rick Mann <email@hidden>
  • Date: Thu, 01 Nov 2012 23:36:23 -0700

Huh. I made this small test case to narrow down the issues. I've noticed something. In my larger project, setBounds: gets called and its parameter shows in the debugger as a Graphics::Rect&. But in my sample project, it's the (correct) Graphics::Rect.

(Note in the sample below I omitted the "Graphics::" namespace.)

I can't figure out why this is. The sample code seems still fails to run correctly.

--
Rick


On Nov 1, 2012, at 19:44 , Rick Mann <email@hidden> wrote:

> 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@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


--
Rick




_______________________________________________

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: -[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes
      • From: Rick Mann <email@hidden>
References: 
 >-[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes (From: Rick Mann <email@hidden>)

  • Prev by Date: Core Data user Info
  • Next by Date: Re: -[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes
  • Previous by thread: -[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes
  • Next by thread: Re: -[NSManagedObject setValuesForKeysWithDictionary:] and C++ attributes
  • Index(es):
    • Date
    • Thread