• 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: core data, boolean attribute, and dynamic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: core data, boolean attribute, and dynamic


  • Subject: Re: core data, boolean attribute, and dynamic
  • From: Martin Hewitson <email@hidden>
  • Date: Fri, 12 Aug 2011 20:38:48 +0200

On Aug 12, 2011, at 06:57 PM, Quincey Morris wrote:

> On Aug 12, 2011, at 04:08 , Martin Hewitson wrote:
>
>> In an app I have a core data model which has a File entity which has a boolean attribute isText. This attribute is declared in the corresponding NSManagedObject subclass interface as
>>
>> @property (assign) BOOL isText;
>>
>> and in the implementation I do
>>
>> @dynamic isText;
>>
>> In Lion, accessing this with
>>
>> [file isText]
>>
>> works fine. But it doesn't work on Snow Leopard. There I have to do
>>
>> [[file valueForKey:@"isText"] boolValue]
>>
>> Is this expected behaviour? Was/is something broken on SL that was fixed on Lion? Or is it now broken on Lion?
>
> Yes. No. No.
>
> It's new on Lion that the internal property accessors referenced by @dynamic support scalar types directly. In the past, if you wanted the type of property "isText" to BOOL rather than NSNumber, you had to write a custom getter and setter to make it so.

OK, that explains the observations. I didn't know about this new behaviour on Lion.

>
> For as long as you need to support 10.6 and earlier, I think you'll have to supply the old-style custom implementations.
>
> I don't think I watched the 2011 WWDC video on Core Data, but it's possible this issue is discussed in there, and there may be a more elegant workaround.

I've watched that one and I don't recall this being mentioned, but I'll look back through it because perhaps it just didn't register the first time through.

Thanks for the information!

Martin

>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
    Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





_______________________________________________

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

References: 
 >core data, boolean attribute, and dynamic (From: Martin Hewitson <email@hidden>)
 >Re: core data, boolean attribute, and dynamic (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: clipping and scrolling
  • Next by Date: Re: migration to 10.6 SDK, loadNib problems
  • Previous by thread: Re: core data, boolean attribute, and dynamic
  • Next by thread: clipping and scrolling
  • Index(es):
    • Date
    • Thread