本文介绍了我可以在Xcode 4中删除Core Data的动态生成方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Core Data生成这四种方法。我可以删除它们,因为它们是动态生成的吗?Core Data generated these four methods. Can I delete them because they're generated dynamically, right?@implementation User// . . .@dynamic authorizations;- (void)addAuthorizationsObject:(NSManagedObject *)value { NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1]; [self willChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects]; [[self primitiveValueForKey:@"authorizations"] addObject:value]; [self didChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects]; [changedObjects release];}- (void)removeAuthorizationsObject:(NSManagedObject *)value { NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1]; [self willChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects]; [[self primitiveValueForKey:@"authorizations"] removeObject:value]; [self didChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects]; [changedObjects release];}- (void)addAuthorizations:(NSSet *)value { [self willChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value]; [[self primitiveValueForKey:@"authorizations"] unionSet:value]; [self didChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];}- (void)removeAuthorizations:(NSSet *)value { [self willChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value]; [[self primitiveValueForKey:@"authorizations"] minusSet:value]; [self didChangeValueForKey:@"authorizations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];} 相关链接: 核心数据方法不在头文件中 Xcode4:为自定义核心数据管理对象生成的不同代码 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.htmlRelated links:Core Data methods not in header fileXcode4: Different code generated for custom core data managed objectshttp://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html推荐答案是的,只要离开 @dynamic 命令将在运行时生成访问器。Yes, as long as you leave the @dynamic command the accessors will be generated at runtime. 这篇关于我可以在Xcode 4中删除Core Data的动态生成方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-28 04:06