icloud-api

CloudKit not returning the most recent data

做~自己de王妃 提交于 2019-11-30 12:15:35
I am having this issue where I save something to the icloud using CloudKit but immediately fetching the results doesn't return the latest data inserted. Example let todoRecord = CKRecord(recordType: "Todos") todoRecord.setValue(todo, forKey: "todotext") publicDB.saveRecord(todoRecord, completionHandler: { (record, error) -> Void in NSLog("Saved in cloudkit") let predicate = NSPredicate(value: true) let query = CKQuery(recordType: "Todos", predicate: predicate) self.publicDB.performQuery(query, inZoneWithID: nil) { results, error in if error != nil { dispatch_async(dispatch_get_main_queue()) {

iCloud NSUbiquitousKeyValueStore initial sync/access delay - how to handle?

ⅰ亾dé卋堺 提交于 2019-11-30 06:52:53
I'm using NSUbiquitousKeyValueStore to store some app settings. My logic is: when I save data locally, I save it to NSUbiquitousKeyValueStore also as a backup. When I need settings, I read locally and I only use iCloud key-value store if no data is found locally (after app is reinstalled, for example). If user has several devices sharing one icloud id, he can write settings on one device and download them to another (I warn him about rewrite). I have a strange issue. Steps: Installed an app and save its data to NSUbiquitousKeyValueStore. Made sure data is there. Removed the app (assuming data

How (and when) do I use iCloud's encodeSystemFields method on CKRecord?

廉价感情. 提交于 2019-11-30 03:51:27
encodeSystemFields is supposed to be used when I keep records locally, in a database. Once I export that data, must I do anything special when de-serializing it? What scenarios should I act upon information in that data? As a variation (and if not covered in the previous question), what does this information help me guard against? (data corruption I assume) encodeSystemFields is useful to avoid having to fetch a CKRecord from CloudKit again to update it (barring record conflicts). The idea is: When you are storing the data for a record retrieved from CloudKit (for example, retrieved via

iCloud: Callback for NSFileManager's startDownloadingUbiquitousItemAtURL?

北慕城南 提交于 2019-11-28 18:53:38
I am using NSFileManager 's startDownloadingUbiquitousItemAtURL to download file from iCloud to local copy (the local does not yet have the copy of the file in this case). I can't seem to find the callback for this process. I need the callback to tell my app that the requested file is finished downloaded (to local copy) so other task can start reading the content of the file and does stuff. I can check to see if the file is downloaded. But it would involve in polling constantly. Is there a way to do this without setting a timer to poll for this? I believe that this method is intended to be

Exposing an app's ubiquitous container to iCloud Drive in iOS 8

那年仲夏 提交于 2019-11-27 18:10:40
I'm developing an iCloud-enabled app where users will be able to import and export files via iCloud Drive. When browsing iCloud Drive, either using the UIDocumentPickerViewController (iOS 8) or the Finder (OS X Yosemite), I can see directories created/owned by other iCloud-Drive-enabled apps, such as, Automator, Keynote, or TextEdit. I want our app to expose its ubiquitous documents directory in iCloud Drive, too, but haven't been able to figure it out yet. Within some of the aforementioned apps' Info.plist files, I've discovered this key: <key>NSUbiquitousContainers</key> <dict> <key>com

iCloud: Callback for NSFileManager's startDownloadingUbiquitousItemAtURL?

一个人想着一个人 提交于 2019-11-27 11:43:31
问题 I am using NSFileManager 's startDownloadingUbiquitousItemAtURL to download file from iCloud to local copy (the local does not yet have the copy of the file in this case). I can't seem to find the callback for this process. I need the callback to tell my app that the requested file is finished downloaded (to local copy) so other task can start reading the content of the file and does stuff. I can check to see if the file is downloaded. But it would involve in polling constantly. Is there a