简体   繁体   English

iCloud-核心数据同步问题

[英]iCloud - Core data sync issue

I get this one error at a critical stage in the app. 我在应用程序的关键阶段遇到此错误。 The scenario is that the MainView gets the listings of entities "Category" in the main view using a predicate "User == %@", currentUser. 场景是MainView使用谓词“ User ==%@” currentUser在主视图中获取实体“类别”的列表。

This page is synced well across the devices via icloud. 该页面可以通过icloud在各个设备之间很好地同步。

There is a User<----->Category <---->>Field<--------->>Entry (timestamp, value). 有一个用户<----->类别<---- >>字段<--------- >>条目(时间戳,值)。 <<------------>User The only difference in this is that Entries can belong to different Users. << ------------> User唯一的区别是条目可以属于不同的User。 hence the last relationship. 因此是最后的关系。

WHEN I do add an "Entry" entity, its created fine locally, but when the logs arrive in the receiving device (via iCloud)... i get this: 当我添加“ Entry”实体时,它会在本地创建良好,但是当日志到达接收设备(通过iCloud)时...我得到了:

2012-02-21 06:36:55.573 APPCloud[2403:4923] -[_PFUbiquityRecordsImporter operation:failedWithError:](839): CoreData: Ubiquity:  Import operation ecountered an error: Error Domain=NSCocoaErrorDomain Code=134060 "The operation couldn’t be completed. (Cocoa error 134060.)" UserInfo=0x79ce410 {exception=Illegal attempt to establish a relationship 'forUser' between objects in different contexts (source = <Entry: 0x855eac0> (entity: Entry; id: 0x855e6b0 <x-coredata:///Entry/tDF69E4F8-35DE-4DC1-8077-F5A563FE0DCC1041> ; data: {    comment = nil;
    forField = nil;
    forUser = nil;
    period = 0;
    timeStamp = nil;
    value = 0;
}) , destination = <User: 0x288820> (entity: User; id: 0x232a10 <x-coredata://43C097FE-4A91-42A9-B8EC-CF32D65F7328/User/p1> ; data: {
    birthday = "1999-02-20 21:00:00 +0000";
    entries =     (
        "0x79aa590 <x-coredata:///Entry/tDF69E4F8-35DE-4DC1-8077-F5A563FE0DCC16>",
        "0x2071d0 <x-coredata://43C097FE-4A91-42A9-B8EC-CF32D65F7328/Entry/p1>",
        "0x206bf0 <x-coredata://43C097FE-4A91-42A9-B8EC-CF32D65F7328/Entry/p2>"
    );
    firstName = Samuel;
    fullName = nil;
    height = 0;
    images =     (
    );
    lastName = User;
    male = 1;
    trackers =     (
        "0x797bb60 <x-coredata://43C097FE-4A91-42A9-B8EC-CF32D65F7328/Tracker/p1>"
    );
    uuid = "07110878-F6D3-482D-BC0E-3CE8B4A581E4HGMG";
    years = 0;
}))} while trying to import the log file at the URL: <PFUbiquityTransactionLog: 0x79ca620>

I use the same context, i dont know whats going on here... and when these logs arrive, none of the other stuf works.. 我使用相同的上下文,我不知道这里发生了什么……当这些日志到达时,其他stuf都无法正常工作。

Please point me to the right direction! 请指出正确的方向!

thanks 谢谢

Are you adding this to a nil or a property context? 您要将其添加到nil或属性上下文中吗? Try not using the local property context 尝试不使用本地属性上下文

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM