【发布时间】:2012-10-24 13:56:14
【问题描述】:
我在 coredata 中有一个具有两个实体的工作模型: - 顾客 - 发票
Customer 具有“invoices”属性(1 对多),Invoices 具有“customer”属性(1 对 1)。 一切正常,直到我覆盖 Invoice 类的“setCustomer”方法。 我写了这段代码
-(void)setCustomer:(Customer *)customer {
[self willChangeValueForKey:@"Customer"];
[self setPrimitiveValue:customer forKey:@"Customer"];
[self didChangeValueForKey:@"Customer"];
[self recalulatePriceAndDiscounts];
}
“recalculatePriceAndDiscount”是我自己选择不同客户时需要调用的方法。
当我使用此代码时,反向关系(客户->发票)无法立即使用,我需要关闭并重新打开我的应用程序才能查看客户的发票。
还有其他方法需要调用吗?
谢谢
【问题讨论】:
标签: core-data