【问题标题】:iCloud - Core data sync issueiCloud - 核心数据同步问题
【发布时间】:2012-02-21 12:09:39
【问题描述】:

我在应用程序的关键阶段遇到了这个错误。 场景是 MainView 使用谓词“User == %@”,currentUser 在主视图中获取实体“Category”的列表。

此页面通过 icloud 在设备之间很好地同步。

有一个用户类别>字段>条目(时间戳,值)。 用户 唯一的区别是条目可以属于不同的用户。因此最后的关系。

当我添加一个“条目”实体时,它在本地创建得很好,但是当日志到达接收设备时(通过 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>

我使用相同的上下文,我不知道这里发生了什么......当这些日志到达时,其他 stuf 都不起作用......

请指点我正确的方向!

谢谢

【问题讨论】:

    标签: objective-c core-data nsmanagedobjectcontext icloud


    【解决方案1】:

    您是将其添加到 nil 还是属性上下文?尽量不要使用本地属性上下文

    【讨论】:

    • 是的,显然我添加的上下文没有正确初始化。我真蹩脚!
    猜你喜欢
    • 2013-01-06
    • 2016-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-25
    • 2014-07-24
    相关资源
    最近更新 更多