Re: CoreData models as structures
Re: CoreData models as structures
- Subject: Re: CoreData models as structures
- From: "Ayers, Joseph" <email@hidden>
- Date: Sat, 6 Nov 2010 09:54:03 -0400
- Acceptlanguage: en-US
- Thread-topic: CoreData models as structures
On Nov 5, 2010, at 7:52 PM, Quincey Morris wrote:
> On Nov 5, 2010, at 15:13, Ayers, Joseph wrote:
>
>> I have a core data model that has a series of to-many relationships of the type:
>>
>> @interface TapeList : NSManagedObject
>> {
>> NSString * ListURL;
>> NSSet* tapes;
>> }
>>
>> @interface tapes : NSManagedObject
>> {
>> NSString * Notes;
>> NSString * TapeName;
>> NSSet * VideoClip;
>> }
>>
>> @interface VideoClip : NSManagedObject
>> {
>> NSString * StartTimeCode;
>> QTMovie * mMovie;
>> NSString * EndTimeCode;
>> NSString * Notes;
>> NSString * movieURL;
>> tapes * CurrentTape;
>> NSSet* Table;
>> }
>>
>> @interface Table : NSManagedObject
>> {
>> NSString * Notes;
>> NSString * Name;
>> NSSet* CommandStates;
>> NSSet* Flexions;
>> NSSet* DataSources;
>> }
>>
>> A reference to tapeList.tapes works fine, but a reference to tapeList.tapes.VideoClip gives me a
>> "request for member "VideoClip in something not a structure or union" compile time error.
>
> I think you've got something wrong here, but there are 2 possibilities for what it is. Choose A or B, if either applies. :)
>
> A. With your declarations, 'tapeList.tapes' is a NSSet. The set doesn't have a "VideoClio" property (though its members do), and the compiler is correctly telling you that you can't refer to such a property. *Which* 'tapes' object are you trying to refer to?
That is indeed the problem. VideoClip is a relationship of tapes. How should this be addressed?
>
> B. This is not how you use properties in Core Data -- you do NOT declare instance variables corresponding to the properties in your data model. Instead, those properties are defined for you by Core Data. You *do* have to supply property declarations to keep the compiler happy (as described in the Core Data documentation).
>
> The manual says that you have to declare the properties to maintain 32bit compatability.
> _______________________________________________
>
> 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
_______________________________________________
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