1
我试图将现有数据从本地存储播种到启用iCloud的存储。当我尝试从本地管理对象访问的关系对象,以下异常被抛出,从本地持久性存储向iCloud存储区播种数据时的管理关系
> illegal attempt to establish a relationship between objects in
> different contexts
这就是我要做的。在提前
NSEntityDescription *entity = [recurringExpense entity];
RecurringExpense *newRecExpense = [[RecurringExpense alloc]initWithEntity:entity insertIntoManagedObjectContext:moc];
newRecExpense.category = recurringExpense.category;
[moc assignObject:newRecExpense toPersistentStore:store];
感谢。
哪里'category'对象创建?错误消息表明它属于不同的上下文。 – 2013-03-17 21:17:41
'recurringExpense'来自不同的上下文。 P.S. 我改变了我的计划并打算使用[https://github.com/alekseyn/iCloudStoreManager](https://github.com/alekseyn/iCloudStoreManager)来处理种子和管理商店。 – 2013-03-18 12:25:32