What’s the most convenient method to check whether a document is in iCloud or not?
Initially I was going to remove the last path component and compare the item url with the container url (assuming it’s non-nil) but realised that it doesn’t take into account possible subdirectories (e.g folders) if I choose to implement them later on.
Thanks
Use an NSMetadataQuery to search for your documents, then when the query returns the array of NSMetadataItems it has found, examine the item's you're interested in using something like:
BOOL isDownloaded = [[item valueForAttribute:NSMetadataUbiquitousItemDownloadingStatusKey] isEqualToString:NSMetadataUbiquitousItemDownloadingStatusCurrent];
BOOL isUploaded = [[item valueForAttribute:NSMetadataUbiquitousItemIsUploadedKey] boolValue];
If an item is both downloaded and uploaded then it is both in iCloud and exists locally on your device.