I am not sure why I am not able to make a reference to the child object properties from parent. Here is the relationship:
@class Vegetable;
@interface MyVegetableGarden : NSManagedObject
@property (nonatomic) NSTimeInterval datecreated;
@property (nonatomic) NSTimeInterval datemodified;
@property (nonatomic) BOOL active;
@property (nonatomic, retain) Vegetable *vegetable;
@end
And here is the Vegetable class:
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class VegetableCategory;
@interface Vegetable : NSManagedObject
@property (nonatomic, retain) NSString * about;
@property (nonatomic) BOOL active;
@property (nonatomic) NSTimeInterval dateCreated;
@property (nonatomic) NSTimeInterval dateModified;
@property (nonatomic, retain) NSString * imageURL;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) VegetableCategory *vegetableCategory;
@end
Now, I am trying to access the name property of the Vegetable class using the following code:
MyVegetableGarden *v = [[MyVegetableGarden alloc] init];
v.vegetable.name // For some reason the compiler says that name property is not found
Make sure you’ve #imported Vegetable.h in the file where you access the name property