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.

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.


_______________________________________________

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

Reply via email to