cloudkit

How do i make my cloudkit app load the data as its loading?

感情迁移 提交于 2019-12-24 14:34:48
问题 In the app i am making, there will be a lot of data for the app to load from iCloud. My problem is that it does not load the data into a collection view until its finished receiving all the data(which takes a while). I want the app to load the data onto the collection view as its receiving the data, so the user does not have to wait. Or is it better to have the app only load some of the data at a time? How do i do this? Here is my code that i am using to load the data. Note: I am using swift

CloudKit Query Time

我们两清 提交于 2019-12-24 11:28:37
问题 I've just started trialling CloudKit and am having some pretty slow query times. Here is some sample code I am using: //CLOUDKIT CKContainer *container = [CKContainer defaultContainer]; CKDatabase *privateDatabase = [container privateCloudDatabase]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"TRUEPREDICATE"]; CKQuery *query = [[CKQuery alloc] initWithRecordType:@"FlightLog" predicate:predicate]; [privateDatabase performQuery:query inZoneWithID:nil completionHandler:^(NSArray

Why does my DateComponents object in iOS not save to or retrieve from CloudKit correctly?

回眸只為那壹抹淺笑 提交于 2019-12-24 07:36:12
问题 I am using CloudKit with Swift for iOS. I am saving an object of type DateComponents in a CloudKit field of type Bytes. When I retrieve the object, it does not have the same value as the object I originally saved. Here is the code where I save the object to CloudKit: let unsafePointer: UnsafePointer<DateComponents> = UnsafePointer<DateComponents>(&time) let unsafeBufferPointer: UnsafeBufferPointer<DateComponents> = UnsafeBufferPointer<DateComponents>(start: unsafePointer, count: 1) let data:

How to update progress with CKModifyRecordsOperation.perRecordProgressBlock

本小妞迷上赌 提交于 2019-12-24 03:05:35
问题 This is related to a recent thread Update progress with MRProgress. I converted my cloudkit queries from the convenience API to CKOperations as a result of previous thread (Thanks Edwin!). So while using CKModifyRecordsOperation to save a record, I can see the record's progress via logging in the perRecordProgressBlock, which is great. However, I'm trying to send this progress back to the viewcontroller and I cannot figure out how to do that. I have created a class for all of my CloudKit

How to fetch all long-lived operations on iOS

∥☆過路亽.° 提交于 2019-12-24 01:08:56
问题 Short summary When I create a long-lived CKModifyRecordsOperation on my iPhone while it is in airplane mode (no internet connection) then quit the application that created the CKModifyRecordsOperation by double tapping the home button and swiping away the application disable airplane mode and connect to the internet via a wifi network (still with the application quit) I can see (in the CloudKit dashboard) that the operation was sent to the iCloud servers and executed properly. But when I then

How to use CKFetchNotificationChangesOperation?

爱⌒轻易说出口 提交于 2019-12-23 23:33:35
问题 How do I use CKFetchNotificationChangesOperation to handle and direct all missed notifications from a subscribed CKSubscription to the - (void)application:(nonnull NSApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo { in my Mac application? The code I have for that method is as follows, - (void)application:(nonnull NSApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo { NSLog(@"CKSubscription received.");

How to find out when a CloudKit Subscription is deleted?

扶醉桌前 提交于 2019-12-23 23:06:22
问题 I am using CloudKit in my iOS application. In my application, whenever user modifies some data, I update the CloudKit private db so that other devices of the user can also get updated. This syncing mechanism can be enabled/disabled by the user. When user enables syncing, I create a subscription and push the local data to CloudKit. If the user has logged on to other devices, they start getting remote notifications about changes to the private database as expected. The application shows a

Fetching user record ID with CloudKit fails

落花浮王杯 提交于 2019-12-23 17:18:07
问题 I'm trying to find the user record ID with CloudKit. I've verified that the account status is CKAccountStatusAvailable . Then I try this: [[CKContainer defaultContainer] fetchUserRecordIDWithCompletionHandler:^(CKRecordID *recordID, NSError *error) { if (error == nil) { NSLog(@"Got user record ID (no permission req): %@", recordID); } else { NSLog(@"Couldn't get user record ID, error=%@", error); } }]; This inevitably fails with the following result: (lldb) po error <CKError 0x608000043990:

CloudKit Subscription Notification for CKReference Not Working As Expected

风格不统一 提交于 2019-12-23 15:44:57
问题 I'm trying to setup a CKSubscription for records that contain a field with a CKReference to the user. But anytime a record is created, it ignores this part of the compoundPredicate and the notification never comes. Is there something different about using a CKReference in a predicate for a CKSubscription? I go into the dashboard to enter a new record under my own user recordID (while running another user in simulator) because I believe I read that if the record comes from the device, it won't

CloudKit - CKQueryOperation with dependency

匆匆过客 提交于 2019-12-23 09:26:24
问题 I'm just beginning working with CloudKit, so bear with me. Background info At WWDC 2015, apple gave a talk about CloudKit https://developer.apple.com/videos/wwdc/2015/?id=715 In this talk, they warn against creating chaining queries and instead recommend this tactic: let firstFetch = CKFetchRecordsOperation(...) let secondFetch = CKFetchRecordsOperation(...) ... secondFetch.addDependency(firstFetch) letQueue = NSOperationQueue() queue.addOperations([firstFetch, secondFetch], waitUntilFinished