1

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

enter image description here

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?

enter image description here enter image description here

4

1 回答 1

2

I resolved this by creating another NSArrayController for my TimeLog and setting up the table like so.

TimeLog Arra Controller

  • Set Controller Content -> Content Set -> Bind to Items array controller. Model Key path to timeLog enter image description here

Then each column of the table.

enter image description here enter image description here

于 2013-03-18T22:29:28.867 回答