I get Lexical or Preprocessor Issue 'Group.h' file not found which I believe is causing the issues below.
I’m trying to call a method on one of my core data class instances and I get a 'Group' may not respond to '-addPeople:' warning. But I do have an addPeople method in my XCode generated Group class, and here it is:
- (void)addPeople:(NSSet *)value {
[self willChangeValueForKey:@"people" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
[[self primitiveValueForKey:@"people"] unionSet:value];
[self didChangeValueForKey:@"people" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
}
I also get the same warning if I try to removePeople. Both of these methods have to do with NSSets but I’m able to call my setters from the Group class just fine.
[selectedObject setTitle:[[titleCell textField] text]]; // works
[selectedObject setSubtitle:[[subTitleCell textField] text]]; // works
NSSet *tempPeople = [NSSet setWithArray:people];
[selectedObject addPeople:tempPeople]; // works, but with warning
Side note
When I type [selectedObject I don’t get autocompletion, although the word selectedObject does autocomplete as a Group. So at least that’s good.
Group.h
@class People;
@interface Group : NSManagedObject {
@private
}
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSNumber * order;
@property (nonatomic, retain) NSString * subtitle;
@property (nonatomic, retain) NSSet* people;
@end
Updated
I just finished making a new UITableViewCell class and now instead of it saying Lexical or Preprocessor Issue 'Group.h' file not found it now says Lexical or Preprocessor Issue 'PersonCell.h' file not found
Lexical or Preprocessor Issue
Well, I couldn’t figure out what my problem was so I made a new project and remade each view controller, core data and whatever else I needed. And that solved my problem. I wish I knew what was really causing the Lexical error but from the looks of other people’s posts, it could have been a bug.
Group’ may not respond to ‘-addPeople:
This issue was resolved by adding the methods to the .h file. I’m not sure why XCode didn’t make those for me, but that solved that problem.
And thanks xianritchie for trying to figure this out with me. It was appreciated.