我有两个 NSManagedObject:
- 数据输入
- 普罗旺斯
它们之间有一个关系:DataEntered 必须有一个 Provence,而 Provence 可能有一个/多个 DataEntered。
一切运行良好,但在使用 Instruments 和 Allocations 时,每次我将 Provence 设置为 DataEntered 时,#Living 中都会出现一个新的 _CDSnapshot_Provence_:
Provence * provence = [[self fetchedResultsController] objectAtIndexPath:indexPath];
[self.dataEntered setAddress_provence:provence];
DataEntered 中 Provence 的 setter 由 CoreData 管理,没有自定义。
当我保存 DataEntered 时,保存正确。什么会导致创建多个生活_CDSnapshot_Provence_?
谢谢!
@class Provence;
@interface DataEntered : NSManagedObject
@property (nonatomic, retain) NSString * name;
@property (nonatomic, strong) Provence *address_provence;
@end
@class Provence;
@interface DataEntered : NSManagedObject
@property (nonatomic, retain) NSString * name;
@property (nonatomic, strong) Provence *address_provence;
@end
@class DataEntered;
@interface Provence : NSManagedObject
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSSet *dataEnteredAddress_Provence;
@end
@interface Provence (CoreDataGeneratedAccessors)
- (void)addDataEnteredAddress_ProvenceObject:(DataEntered *)value;
- (void)removeDataEnteredAddress_ProvenceObject:(DataEntered *)value;
- (void)addDataEnteredAddress_Provence:(NSSet *)values;
- (void)removeDataEnteredAddress_Provence:(NSSet *)values;
@end
#import "Provence.h"
#import "DataEntered.h"
@implementation Provence
@dynamic name;
@dynamic dataEnteredAddress_Provence;
@end