Generating NSManagedObjectSubclass Automatically
I see that Xcode properly add these methods on Business.m
- (void)addDistrictsObjectDistrict *)value {
NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
[self willChangeValueForKey:@"Districts" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
[[self primitiveValueForK开发者_高级运维ey:@"Districts"] addObject:value];
[self didChangeValueForKey:@"Districts" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
[changedObjects release];
}
Unfortunately xcode do not add
(void)addDistrictsObjectDistrict *)value;
On Business.h
In other words the method is not exactly advertised to others.
Why?
I got compilerwarning when I tried to use function addDistrictsObject
Also I do not want to change either Business.h or Business.m The xdatamodel will still change a lot.
So what should I do?
Any way to avoid compiler warning? How should I use addObject without compiler warning using only generated code? Any category solution?
If your data model is going to change a lot, you might want to use mogenerator to generate your class files instead of the Xcode tool.
精彩评论