MagicalRecord iCloud 问题

Posted

技术标签:

【中文标题】MagicalRecord iCloud 问题【英文标题】:MagicalRecord iCloud issues 【发布时间】:2013-02-13 15:59:07 【问题描述】:

我正在尝试将 MagicalRecord 与 iCloud 一起使用,并且每次我打电话时

    [MagicalRecord setupCoreDataStackWithiCloudContainer:nil localStoreNamed:@"MyApp.sqlite"];

我第一次在下面看到这些日志……以前有人看过吗?我已经清理了项目并删除了应用程序,但我每次都得到它。

我可以在 Settings>iCloud 中看到我的应用,但在 developer.icloud.com 文档文件夹中没有任何内容

    2013-02-13 09:25:56.247 MyApp[6902:5d17] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/current.nosync/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    Confused by: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    2013-02-13 09:25:56.248 MyApp[6902:5807] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    Confused by: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    2013-02-13 09:25:56.253 MyApp[6902:1507] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/.stage.nosync/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    Confused by: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    2013-02-13 09:25:56.259 MyApp[6902:1507] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=/staging.nosync
    Confused by: staging.nosync
    2013-02-13 09:25:56.261 MyApp[6902:1507] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/current.nosync/iCloudStore
    Confused by: iCloudStore
    2013-02-13 09:25:56.263 MyApp[6902:1507] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.cdmetadata/metadata.nosync/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/metadata.store-wal
    Confused by: metadata.store-wal
    2013-02-13 09:25:56.274 MyApp[6902:170b] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/Data.nosync/.baseline/current.nosync/iCloudStore/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=/baseline.model
    Confused by: baseline.model
    2013-02-13 09:25:56.279 MyApp[6902:1413] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.cdmetadata/metadata.nosync/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/metadata.store-shm
    Confused by: metadata.store-shm
    2013-02-13 09:25:56.286 MyApp[6902:170b] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/mobile.DDDDDD-DDDD-DDDD-DDDD-DDDDDDDDD/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    Confused by: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    2013-02-13 09:25:56.291 MyApp[6902:170b] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=/baseline.zip
    Confused by: baseline.zip
    2013-02-13 09:25:56.292 MyApp[6902:1413] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/SyncData/com.walshitech.sbrspeeds/ClientDevices/ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ-ZZZZ-ZZZZZZZZZ
    Confused by: ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ-ZZZZ-ZZZZZZZZZ
    2013-02-13 09:25:56.297 MyApp[6902:1413] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/current.nosync/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=/baseline.meta
    Confused by: baseline.meta
    2013-02-13 09:25:56.298 MyApp[6902:170b] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=/staging.nosync/iCloudStore.sqlite
    Confused by: iCloudStore.sqlite
    2013-02-13 09:25:56.306 MyApp[6902:5d17] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/Data.nosync/.baseline/current.nosync/iCloudStore/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=/baseline.meta
    Confused by: baseline.meta
    2013-02-13 09:25:56.310 MyApp[6902:5d17] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/Data.nosync/.baseline/iCloudStore/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=/baseline.zip
    Confused by: baseline.zip
    2013-02-13 09:25:56.315 MyApp[6902:170b] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.cdmetadata/metadata.nosync/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/metadata.store
    Confused by: metadata.store
    2013-02-13 09:25:56.315 MyApp[6902:1507] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.cdmetadata/metadata.nosync/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY
    Confused by: mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY
    2013-02-13 09:25:56.324 MyApp[6902:1507] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/SyncData/com.walshitech.sbrspeeds/Information/DeletedDocuments
    Confused by: DeletedDocuments
    2013-02-13 09:25:56.324 MyApp[6902:5d17] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/current.nosync/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=/baseline.model
    Confused by: baseline.model
    2013-02-13 09:25:56.324 MyApp[6902:170b] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/SyncData/com.walshitech.sbrspeeds/Information/DeletedClients
    Confused by: DeletedClients
    2013-02-13 09:25:56.325 MyApp[6902:1413] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/SyncData/com.walshitech.sbrspeeds/ClientDevices/YYYYYYY-YYYY-YYYY-YYYY-YYYYYYYY-YYYY-YYYYYYYYYYY5
    Confused by: YYYYYYY-YYYY-YYYY-YYYY-YYYYYYYY-YYYY-YYYYYYYYYYY5
    2013-02-13 09:25:56.328 MyApp[6902:5807] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/.stage.nosync/iCloudStore
    Confused by: iCloudStore
    2013-02-13 09:25:56.330 MyApp[6902:1507] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/current.nosync/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=/baseline.gcmodel
    Confused by: baseline.gcmodel
    2013-02-13 09:25:56.330 MyApp[6902:5207] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.baseline/iCloudStore/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    Confused by: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
    2013-02-13 09:25:56.346 MyApp[6902:5d17] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.cdmetadata/metadata.nosync/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/iCloudStore
    Confused by: iCloudStore
    2013-02-13 09:25:56.348 MyApp[6902:5207] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/iCloudData/.cdmetadata/metadata.nosync/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY/iCloudStore/CCCCCC-CCCC-CCCC-CCCC-CCCCCCCCC.cid
    Confused by: CCCCCC-CCCC-CCCC-CCCC-CCCCCCCCC.cid
    2013-02-13 09:25:56.349 MyApp[6902:5d17] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/Data.nosync/.baseline/iCloudStore/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=/mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY
    Confused by: mobile.YYYYYYY-YYYY-YYYY-YYYYYYYY
    2013-02-13 09:25:56.358 MyApp[6902:5207] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootPath:](821): CoreData: Ubiquity:  Unable to continue parse components of URL: /var/mobile/Library/Mobile Documents/XXXXXXXXXXX~com~my~app/Data.nosync/.baseline/current.nosync/iCloudStore/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=/baseline.gcmodel
    Confused by: baseline.gcmodel

【问题讨论】:

哇,我见过很多不同的 iCloud 错误,但这是我的一个新错误。我能猜到的是,iCloudDataSyncData 等目录可能不存在,而 iCloud 正因此而烦恼。不过,只是猜测。 是的,我不知道如何解决这个问题。由于我使用的是 MagicalRecord,因此很难确定问题是代码还是 iCloud 过于难以使用。我认为是后者。 Tom:有什么办法可以强制在 iCloud 中创建这些目录? 通常的方法是使用-[NSFileManager URLForUbiquityContainerIdentifier:] 获取ubiquity 目录的位置,然后使用普通的NSFileManager 调用创建目录。我不知道Magical Record是否应该为你处理这件事。您可以通过developer.icloud.com 登录 iCloud 帐户来查看它们是否存在。 经过一些测试,我创建了目录,但仍然出现同样的问题。我很惊讶以前没有人见过这种情况。我更改了逻辑以使用它,但仍然没有运气:[MagicalRecord setupCoreDataStackWithiCloudContainer:@"XXXX.com.company.myapp" localStoreNamed:@"MyApp.sqlite"]; 【参考方案1】:

我知道这是一个老问题,但对于刚刚遇到这个问题的人来说,我想我找到了解决方案。对我来说,这是模拟器的问题。显然模拟器会创建一些设备无法正常访问的奇怪文件。

尝试按以下顺序执行以下操作,看看它是否会消失:

    ios 模拟器和设备中删除您的应用,并且您已经安装了它。 在您的 iPhone / iPad(不是模拟器)上,转到设置 > iCloud > 存储和备份 > 管理存储 > Your_app_name > 编辑(右上角)> 全部删除。 尝试在您的设备上再次安装该应用。

希望奇怪的错误不再存在。再次在模拟器上运行应用程序可能会重新创建它们,您将不得不重复该过程。

【讨论】:

【参考方案2】:

我可以告诉你它们是什么,但不是一个有保证的解决方案。

我将这些文件称为“幽灵文件”,它们是由您或您的应用在 ubiquity 目录中创建的。

要显示这是正在发生的事情,请转到 Mac 上用户库中的“移动文档”文件夹,转到“/var/mobile/Library/Mobile Documents/XXXXXXXXXXXX~com~my~app/iCloudData ”文件,然后手动通过“命令N”创建一个新文件。

然后从那时起,您将收到一个额外的“错误”,其中“无标题文件夹”作为它无法“解析”的文件...

从您的设备中删除所有内容似乎会将这些文件留在实际的 iCloud 数据服务器上(我认为)。创建“幽灵文件”

如果这是一个开发者帐户,您可以通过以下方式查看甚至删除它们:

https://developer.icloud.com/ 并使用您的开发者 ID 登录。

如果这是一个测试帐户,那么我似乎无法删除这些文件..

你可以通过简单地在你的代码中创建新目录来解决它,所以不要用“iCloudData”这个词来组成一个新的“iCloudData2”之类的东西,

您现在可以让 iCloud 再次工作,但是,您将继续在控制台中看到这些警告/错误...

如果有人想出如何从测试用户帐户中删除它们“换句话说,一个非开发者 ID”,请告诉我...

过去您可以访问上述网站并输入您的测试用户 ID,但在 Apple 的无限智慧中,他们在几个月前将其更改为现在只有开发者 ID。

【讨论】:

以上是关于MagicalRecord iCloud 问题的主要内容,如果未能解决你的问题,请参考以下文章

MagicalRecord 是不是同时支持自动迁移和 iCloud?

具有 MagicalRecord 的多个数据库或仅将部分数据库同步到 iCloud

更高效的 iCloud 同步?

如何检查 iCloud 中是不是有内容?核心数据

MagicalRecord 没有使用我的模型

MagicalRecord:[MagicalRecord saveWithBlock] 中的死锁