Reputation: 11855
I have 2 Core Data objects. Items
and TimeLog
. The items object has a one to many relation with TimeLog and I am using the IB and Array Controller to automatically populate the 2 NSTableView
's
The top table view is for the items. When you select an item the bottom table should populate with the time logs.
However when I add an item, the application crashes with an error
<_NSFaultingMutableSet 0x102e0e790> addObserver:forKeyPath:options:context:] is not supported. Key path: date
I am using an Array Controller to populate all the information automatically. When I create and add and item I am not setting anything for the timeLog relationship because there is no time to add when they first add the item. The object is saving as I have logging that is triggered after the core data save event.
Items.h
@class TimeLog;
@interface Items : NSManagedObject
@property (nonatomic, retain) NSString * itemId;
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSString * itemType;
@property (nonatomic, retain) NSSet *timeLog;
@end
@interface Items (CoreDataGeneratedAccessors)
- (void)addTimeLogObject:(TimeLog *)value;
- (void)removeTimeLogObject:(TimeLog *)value;
- (void)addTimeLog:(NSSet *)values;
- (void)removeTimeLog:(NSSet *)values;
@end
TimeLog.h
@class Items;
@interface TimeLog : NSManagedObject
@property (nonatomic, retain) NSString * time;
@property (nonatomic, retain) NSDate * date;
@property (nonatomic, retain) Items *item;
@end
What is causing this error and how do I get rid of it?
Upvotes: 1
Views: 437
Reputation: 11855
I resolved this by creating another NSArrayController
for my TimeLog
and setting up the table like so.
TimeLog Arra Controller
Items
array controller. Model Key path to timeLog
Then each column of the table.
Upvotes: 2