开发者

Generating NSManagedObjectSubclass Automatically

开发者 https://www.devze.com 2023-03-05 07:31 出处:网络
I see that Xcode properly add these methods on Business.m - (void)addDistrictsObjectDistrict *)value {

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号