我有一个使用核心数据的iOS和OSX应用,我试图使用iCloud同步它们。
我的问题是,当我在OSX应用程序中更新某些内容时,iOS应用程序将仅在重新启动后显示更新。我在设备上测试,iOS 8.3,iCloud驱动器已启用。
为了调查此问题,我在iOS应用程序中添加了观察员以获取相关通知,包括NSPersistentStoreDidImportUbiquitousContentChangesNotification。这仅在我启动应用程序时发生的同步调用。
我还设置了调试级别:
-com.apple.CoreData.SQLDebug 1
-com.apple.coredata.ubiquity.logLevel 3
查看输出,来自OSX应用程序的更新总是会到来 - 但就是这样。没有通知,当我获取数据时,更新不存在。只有在我下次启动应用程序之后它才会出现。
我进一步调查了一下,设备中有一个文件夹...... / AppData / Documents / CoreDataUbiquitySupport /
似乎包含iCloud文件,在store /那里有一个myappname.sqlite文件,我认为该应用程序存储了当前的iCloud数据。因此,在更新完成日志记录后,我下载了此文件,使用sqlite打开并检查表是否已更新且它们不是。所以它甚至在写入iCloud sqlite商店之前就失败了?
这是我在控制台中看到的日志,我没有看到错误或警告:
2015-05-30 13:18:50.001 test[785:252698] -[PFUbiquityFilePresenter presentedSubitemDidChangeAtURL:](278): CoreData: Ubiquity: <PFUbiquityFilePresenter: 0x1742a16e0>
ubiquityRootLocation: <PFUbiquityLocation: 0x1742a1680>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore
localPeerID: mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B
Got change notification for url: file:///var/mobile/Library/Mobile%20Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/myuser~18B3B992-1F5C-556D-9692-CCA3E72364E0/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/.25742215-F540-4D6C-97B0-40839DA02C08.1.cdt.icloud
2015-05-30 13:18:50.001 test[785:252699] -[PFUbiquityFilePresenter presentedSubitemDidChangeAtURL:](278): CoreData: Ubiquity: <PFUbiquityFilePresenter: 0x1742a16e0>
ubiquityRootLocation: <PFUbiquityLocation: 0x1742a1680>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore
localPeerID: mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B
Got change notification for url: file:///var/mobile/Library/Mobile%20Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/myuser~18B3B992-1F5C-556D-9692-CCA3E72364E0/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/.1D8977DB-5003-4890-BB1A-BD1A5585AD4C.1.cdt.icloud
2015-05-30 13:18:50.002 test[785:252700] -[PFUbiquityFilePresenter processPendingURLs](316): CoreData: Ubiquity: <PFUbiquityFilePresenter: 0x1742a16e0>
ubiquityRootLocation: <PFUbiquityLocation: 0x1742a1680>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore
localPeerID: mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B
Processing pending urls: (
"file:///var/mobile/Library/Mobile%20Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/myuser~18B3B992-1F5C-556D-9692-CCA3E72364E0/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/.25742215-F540-4D6C-97B0-40839DA02C08.1.cdt.icloud"
)
2015-05-30 13:18:50.003 test[785:252700] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootLocation:](1102): CoreData: Ubiquity: Changing path component to remove promise suffix previous: .25742215-F540-4D6C-97B0-40839DA02C08.1.cdt.icloud
2015-05-30 13:18:50.003 test[785:252700] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootLocation:](1104): CoreData: Ubiquity: Changing path component to remove promise suffix new: .25742215-F540-4D6C-97B0-40839DA02C08.1.cdt
2015-05-30 13:18:50.003 test[785:252700] +[PFUbiquityLocation createUbiquityLocationForPath:withUbiquityRootLocation:](1142): CoreData: Ubiquity: Ignoring private file: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/myuser~18B3B992-1F5C-556D-9692-CCA3E72364E0/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/.25742215-F540-4D6C-97B0-40839DA02C08.1.cdt.icloud
2015-05-30 13:18:50.003 test[785:252700] -[PFUbiquityFilePresenter processPendingURLs](338): CoreData: Ubiquity: Didn't get a location back for url: file:///var/mobile/Library/Mobile%20Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/myuser~18B3B992-1F5C-556D-9692-CCA3E72364E0/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/.25742215-F540-4D6C-97B0-40839DA02C08.1.cdt.icloud
2015-05-30 13:18:50.008 test[785:252700] -[PFUbiquityFilePresenter processPendingURLs](472): CoreData: Ubiquity: <PFUbiquityFilePresenter: 0x1742a16e0>
ubiquityRootLocation: <PFUbiquityLocation: 0x1742a1680>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore
localPeerID: mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B
Status: {
"<PFUbiquityLocation: 0x1742a9f00>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/87885B51-6E5C-4ADD-8903-18183FB55E5E.1.cdt" = "<PFUbiquityLocationStatus: 0x174262340> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9cc0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/baseline.meta" = "<PFUbiquityLocationStatus: 0x1702683c0> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742aa5c0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/742F2C0E-2199-4521-8408-8D0DC5D53E26.1.cdt" = "<PFUbiquityLocationStatus: 0x174262640> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aa0e0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/baseline.zip" = "<PFUbiquityLocationStatus: 0x17006d600> - 1:1:0:0:1:0:1:0:0:0:0:4";
"<PFUbiquityLocation: 0x1742a9d20>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/4219C00A-B39D-4043-A7DF-1C6E84A031B4.1.cdt" = "<PFUbiquityLocationStatus: 0x174262b00> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9e40>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/F2D2F34E-3902-4127-B7A9-E85F0B159B0C.1.cdt" = "<PFUbiquityLocationStatus: 0x174260e80> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a5ac0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/630D0759-73F5-4739-8FE1-ED061219A5AE.1.cdt" = "<PFUbiquityLocationStatus: 0x170471100> - 1:0:0:0:0:0:0:0:1:0:0:0";
"<PFUbiquityLocation: 0x1742a9b40>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/8BC68ABF-A736-4B7C-B082-7A17A0EEA60D.1.cdt" = "<PFUbiquityLocationStatus: 0x174262200> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9ae0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/F2B1DADE-CD85-4F64-91D1-3A4C84207B4E.1.cdt" = "<PFUbiquityLocationStatus: 0x174265080> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a4020>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/E6358C25-2296-4441-AA6E-A015C409699E.1.cdt" = "<PFUbiquityLocationStatus: 0x174260cc0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9480>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.cdmetadata/metadata.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/metadata.store-shm" = "<PFUbiquityLocationStatus: 0x174263680> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9540>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore" = "<PFUbiquityLocationStatus: 0x17427e7c0> - 1:1:0:0:1:0:1:0:0:0:0:2";
"<PFUbiquityLocation: 0x1742a6c60>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.cdmetadata/metadata.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/metadata.store-wal" = "<PFUbiquityLocationStatus: 0x1742639c0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aafe0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/.stage.nosync/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/8555B34F-46AA-4CB8-83CE-738E67A82A38.1.cdt" = "<PFUbiquityLocationStatus: 0x174462980> - 1:0:0:0:0:0:0:0:0:0:0:1";
"<PFUbiquityLocation: 0x1740bc8c0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/A99ACC8B-E16E-4DD3-A20F-635DCF514E23.1.cdt" = "<PFUbiquityLocationStatus: 0x174261a40> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a98a0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/969230F8-B32D-49C5-B31F-F512EFC36E70.1.cdt" = "<PFUbiquityLocationStatus: 0x174261fc0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a8e20>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/41DCB49A-A693-43FC-A1B4-BA2EBD2E5B45.1.cdt" = "<PFUbiquityLocationStatus: 0x170269c80> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a5c40>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/CB2102BC-10D5-47C8-A647-0B838A0197B3.1.cdt" = "<PFUbiquityLocationStatus: 0x174079bc0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9840>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/stores/test.sqlite-wal" = "<PFUbiquityLocationStatus: 0x17427b180> - 1:1:0:0:1:0:1:0:0:0:0:2";
"<PFUbiquityLocation: 0x1742aa260>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/076BFC43-BD30-4684-914D-C0F64F29E39A.1.cdt" = "<PFUbiquityLocationStatus: 0x174263200> - 1:0:1:0:1:1:1:0:0:0:0:2";
"<PFUbiquityLocation: 0x1742a97e0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/827A3965-33CB-4E86-9AC0-44177F3950DA.1.cdt" = "<PFUbiquityLocationStatus: 0x1742623c0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742ab1c0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/0449BB68-BF66-4104-A442-8C065AC087E2.1.cdt" = "<PFUbiquityLocationStatus: 0x17007ad80> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9660>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/2391FEBB-8066-426E-9A81-55C906F8703F.1.cdt" = "<PFUbiquityLocationStatus: 0x17427b640> - 1:0:0:0:0:0:0:0:1:0:0:0";
"<PFUbiquityLocation: 0x1742aaaa0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/A25E48EB-88BF-4185-B3AD-1F5D5C115829.1.cdt" = "<PFUbiquityLocationStatus: 0x174261d40> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aa620>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/baseline.gcmodel" = "<PFUbiquityLocationStatus: 0x170268580> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742aa3e0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/2C4BD0A0-991C-47C6-9DE6-E03DA27C71A9.1.cdt" = "<PFUbiquityLocationStatus: 0x170269780> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aa320>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/D6183E45-7C5A-4E98-B6BD-7D275CBDE988.1.cdt" = "<PFUbiquityLocationStatus: 0x174260000> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a96c0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/B38B652F-D4C8-4D0B-ACF0-1587147C98E6.1.cdt" = "<PFUbiquityLocationStatus: 0x174261900> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aace0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/2D09A7D4-99E6-4EF3-8D68-EA340512B8D3.1.cdt" = "<PFUbiquityLocationStatus: 0x174262cc0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aaec0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=" = "<PFUbiquityLocationStatus: 0x1702686c0> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742a9600>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/.stage.nosync/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/2391FEBB-8066-426E-9A81-55C906F8703F.1.cdt" = "<PFUbiquityLocationStatus: 0x174463140> - 1:0:0:0:0:0:0:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a95a0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/3E7B6730-BD1E-49C3-9459-BD1B3E3E652F.1.cdt" = "<PFUbiquityLocationStatus: 0x170269b80> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aa020>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/CBD3B432-8DF5-43C9-8546-BBD0C20FB3E4.1.cdt" = "<PFUbiquityLocationStatus: 0x174079c00> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aab60>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/0A1A594C-9C2E-4EFF-A5B7-0A6F17C0C137.1.cdt" = "<PFUbiquityLocationStatus: 0x17026c900> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a94e0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/.stage.nosync/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/B1D0639C-4C5F-42CF-8864-3CC19DC1EDAA.1.cdt" = "<PFUbiquityLocationStatus: 0x17427f340> - 1:0:0:0:0:0:0:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a9780>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/A3697FCA-1ABA-471E-8D6C-F10022308DE0.1.cdt" = "<PFUbiquityLocationStatus: 0x174261c00> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1740bc860>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/C759813C-9A63-4D32-97CF-1E5165067C36.1.cdt" = "<PFUbiquityLocationStatus: 0x174079880> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aa8c0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/stores/test.sqlite" = "<PFUbiquityLocationStatus: 0x170268600> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742aa1a0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/baseline.model" = "<PFUbiquityLocationStatus: 0x174263a00> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742aa920>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/272FCDFE-E1D2-4662-B157-8728AD3EFDB2.1.cdt" = "<PFUbiquityLocationStatus: 0x170269700> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aa140>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/7FCD89BC-C846-49BF-A95A-5CFAB9448347.1.cdt" = "<PFUbiquityLocationStatus: 0x174262480> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a0a20>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/0E218E99-0962-46BD-AB22-7ABF8A9E936A.1.cdt" = "<PFUbiquityLocationStatus: 0x170268900> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a6de0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/6B84E477-5DD1-430E-AF69-B765D3C028EB.1.cdt" = "<PFUbiquityLocationStatus: 0x174262800> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a08a0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/1C6FE964-49C9-417E-AFFC-CEE28053E74D.1.cdt" = "<PFUbiquityLocationStatus: 0x170462740> - 1:0:0:0:0:0:0:0:1:0:0:0";
"<PFUbiquityLocation: 0x1742a4da0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/080A1B89-749E-47A2-AF4F-A636C8A94454.1.cdt" = "<PFUbiquityLocationStatus: 0x174263180> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a6f60>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/8555B34F-46AA-4CB8-83CE-738E67A82A38.1.cdt" = "<PFUbiquityLocationStatus: 0x17427e640> - 1:0:0:0:0:0:0:0:1:0:0:0";
"<PFUbiquityLocation: 0x1742a0900>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/253BBE81-EA9F-4671-8969-F30D103D55FD.1.cdt" = "<PFUbiquityLocationStatus: 0x170262ac0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a0960>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/staging.nosync" = "<PFUbiquityLocationStatus: 0x170268480> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742a71a0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B" = "<PFUbiquityLocationStatus: 0x17427f140> - 1:1:0:0:1:0:1:0:0:0:0:2";
"<PFUbiquityLocation: 0x1742ab700>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/36C921A5-4C1D-426E-81D8-F0FB58E54015.1.cdt" = "<PFUbiquityLocationStatus: 0x174262c40> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a7080>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/A45B5392-7058-47AB-BD24-6BFE75F44E08.1.cdt" = "<PFUbiquityLocationStatus: 0x174261ac0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aba60>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/D184C67D-9CD9-4491-9106-3BC11496224D.1.cdt" = "<PFUbiquityLocationStatus: 0x174079f40> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742ac900>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/27FCC3D4-E764-4FE2-ACFC-5C4E7AC290FD.1.cdt" = "<PFUbiquityLocationStatus: 0x174262d40> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1740bfb00>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/9BD5A34F-70CC-46FB-921C-57B61AE9D9C0.1.cdt" = "<PFUbiquityLocationStatus: 0x174261dc0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742aac20>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B.nosync" = "<PFUbiquityLocationStatus: 0x170464b00> - 1:0:0:0:0:0:0:0:0:0:0:2";
"<PFUbiquityLocation: 0x1742a6420>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/43810FDD-2F3B-466F-AB6E-E942A1AEC398.1.cdt" = "<PFUbiquityLocationStatus: 0x1742629c0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a8d60>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/9A26E6CE-F937-443E-AF55-2CF77A01ECD9.1.cdt" = "<PFUbiquityLocationStatus: 0x174261f00> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1740bfa40>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/receipt.0.cdt" = "<PFUbiquityLocationStatus: 0x1742635c0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a2f40>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.cdmetadata/metadata.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/metadata.store" = "<PFUbiquityLocationStatus: 0x1742638c0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a22e0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/DCC947CE-E16F-461B-81AB-237C7062F630.1.cdt" = "<PFUbiquityLocationStatus: 0x174260840> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a41a0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/CD617B67-1C1D-4DEB-906F-6C61A7BD51CE.1.cdt" = "<PFUbiquityLocationStatus: 0x174079dc0> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1740bfe60>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/stores/test.sqlite-shm" = "<PFUbiquityLocationStatus: 0x170462d80> - 1:1:0:0:1:0:1:0:0:0:0:2";
"<PFUbiquityLocation: 0x1742ab040>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/current.nosync/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/stores" = "<PFUbiquityLocationStatus: 0x1702684c0> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742a3ae0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/myuser~18B3B992-1F5C-556D-9692-CCA3E72364E0/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/E424D9DB-095E-4249-80C5-690421CAC5CC.1.cdt" = "<PFUbiquityLocationStatus: 0x170268380> - 1:1:0:0:1:0:1:0:0:0:0:2";
"<PFUbiquityLocation: 0x1742a0240>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/.baseline/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/staging.nosync/test.sqlite" = "<PFUbiquityLocationStatus: 0x174263800> - 1:1:0:0:1:0:1:0:0:0:0:3";
"<PFUbiquityLocation: 0x1742a1fe0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/tempLogs.nosync/MyAppCloudStore/O0E9CJ8MXv4CrpcI30W5D66J__RwDzBqJB62ARBB~ag=/8555B34F-46AA-4CB8-83CE-738E67A82A38.1.cdt" = "<PFUbiquityLocationStatus: 0x17026ad40> - 1:0:0:0:0:0:0:0:0:0:0:1";
"<PFUbiquityLocation: 0x1740bfc20>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=" = "<PFUbiquityLocationStatus: 0x174460e00> - 1:1:0:0:1:0:1:0:0:0:0:2";
"<PFUbiquityLocation: 0x1740bfec0>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/BF36B655-99AC-42DB-A12D-261312D3F504.1.cdt" = "<PFUbiquityLocationStatus: 0x174071040> - 1:1:0:0:1:0:1:0:0:0:0:1";
"<PFUbiquityLocation: 0x1742a3c60>: /var/mobile/Library/Mobile Documents/iCloud~com~test~test/CoreData/MyAppCloudStore/mobile~9DQOCDBD-08A2-22A9-B8C1-1UI67EB4DE8B/MyAppCloudStore/O0AACJ8OP24CrpcI30W5Q66J__RaDzBzJB134RBB~ag=/6A634643-DE1A-431D-9C13-18BB5CD53517.1.cdt" = "<PFUbiquityLocationStatus: 0x170269ec0> - 1:1:0:0:1:0:1:0:0:0:0:1";
...
答案 0 :(得分:0)
我从几天起就遇到了同样的问题。现在它适用于两者:OSX&lt; - &gt; iOS版。
在一个线程中运行“startQuery”并添加通知“receiveUpdate:”使其正常工作。
这是我的代码:...
@property (nonatomic, strong) NSMetadataQuery * metadataQuery;
@property (nonatomic, strong) NSNotificationCenter *notificationCenter;
...
//in Application launch:
metadataQuery = [[NSMetadataQuery alloc] init];
[metadataQuery setSearchScopes:[NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]];
NSPredicate *pred = [NSPredicate predicateWithFormat: @"%K like '*.fcb'", NSMetadataItemFSNameKey];
[metadataQuery setPredicate:pred];
notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self
selector:@selector(endUpdate:)
name:NSMetadataQueryDidFinishGatheringNotification
object:metadataQuery];
[notificationCenter addObserver:self selector:@selector(recievedUpdate:) name:NSMetadataQueryDidUpdateNotification object:metadataQuery];
dispatch_async(dispatch_get_main_queue(), ^{
[metadataQuery startQuery];
});
//then
- (void)recievedUpdate:(NSNotification *)notification {
// Log file update
NSLog(@"[iCloud] An update has been pushed from iCloud with NSMetadataQuery");
// Get the updated files
[self updateICloudFiles];
}
-(void)endUpdate:(NSNotification *)notification
{
[self updateICloudFiles];
}
-(void)updateICloudFiles{
[cloudFilenames removeAllObjects];
for (NSMetadataItem *item in [metadataQuery results]) {
NSURL *url = [item valueForAttribute:NSMetadataItemURLKey];
NSString *fileStatus;
[url getResourceValue:&fileStatus forKey:NSURLUbiquitousItemDownloadingStatusKey error:nil];
if ([fileStatus isEqualToString:NSURLUbiquitousItemDownloadingStatusDownloaded]) {
// File will be updated soon
}
if ([fileStatus isEqualToString:NSURLUbiquitousItemDownloadingStatusCurrent]) {
if (![cloudFilenames containsObject:url]) {
NSLog(@"success downloading: %@", [url lastPathComponent]);
[cloudFilenames addObject:url];
}
} else if ([fileStatus isEqualToString:NSURLUbiquitousItemDownloadingStatusNotDownloaded]) {
NSError *error;
BOOL downloading = [[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL:url error:&error];
}
}
[cloudfilesTableView reloadData];
[_ProgramStartOptions.lastFilesView reloadData];
}