So I've got two entities, one called "List" and one called "Task". Each of them has multiple attributes and one relationship. The relationship for List is called "hasTasks" and it is a one to many relationship.
This is the Task.h file that is generated for me.
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Task;
@interface List : NSManagedObject
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * number;
@property (nonatomic, retain) NSNumber * tasks;
@property (nonatomic, retain) NSNumber * totalTime;
@property (nonatomic, retain) NSSet *hasTasks;
@end
@interface List (CoreDataGeneratedAccessors)
- (void)addHasTasksObject:(Task *)value;
- (void)removeHasTasksObject:(Task *)value;
- (void)addHasTasks:(NSSet *)values;
- (void)removeHasTasks:(NSSet *)values;
@end
Now whenever I call something along the lines of
[self.list addHasTasksObject:task];
my app crashes when it gets to this point. Anybody have an idea why this is? If you need to see any more of my code, don't hesitate to ask. Thanks in advance!
I had this same problem and I fixed it in the .xcdatamodeld file. I had accidentally selected the ordered arrangement checkbox for a relationship without re-generating the NSManagedObject classes. Unchecking this box and re-building solved this problem for me. If you are still having a problem, try re-generating your NSManagedObject classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With