Re: Populating a new SQLite Core Data store with default data
Re: Populating a new SQLite Core Data store with default data
- Subject: Re: Populating a new SQLite Core Data store with default data
- From: Frédéric Testuz <email@hidden>
- Date: Mon, 23 Feb 2009 22:22:38 +0100
Le 23 févr. 09 à 21:50, Jon C. Munson II a écrit :
I meant:
[(MyClassyClass *)obj doSomethingSpecificToMyClassyClass]
The cast needs to be applied to the pointer - obj - and not to the
returned value (outside the [ ] square brackets).
--
I.S.
[Jon C. Munson II] That made a difference. I took your literal word
originally. :)
After adding @class anEntity; to the .h file (may not be necessary,
but did
it anyway), and adding #import "anEntity.h" to the .m file, using:
[(anEntity *)someObject setAttribute:@"somevalue"];
everything worked just peachy. This uses the dynamic setter for the
anEntity class.
So, I'll switch from using the KVC calls to the casted calls to take
advantage of better efficiency.
Thank you, Quincey Morris, for your insight, I appreciate it.
I could not, however get this to work (and it may not be possible)
with the
appropriate @class & #import:
(anEntity *)someObject.attribute = @"somevalue";
Is there a way to implement that methodology as well? Correct me if
I'm
wrong, however, the dot syntax is the same as the dynamic setter,
right? To
use this methodology, does one then need to use the explicit
someObject
instead of the generic version:
// generic
NSManagedObject someObject = [NSEntityDescription insert...];
(anEntity *)someObject.attribute = @"somevalue";
Same here, I don't know if this must be seen as a bug or not. This
works for me :
((anEntity *)someObject).attribute = @"somevalue";
Frédéric_______________________________________________
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