cloudkit

CloudKit compound query (query with OR)

耗尽温柔 提交于 2019-12-01 17:36:12
问题 I would like to query CloudKit using OR with two fields. But I can't find a way how to do this. What I did is: NSPredicate *predicate1 = [NSPredicate predicateWithFormat:@"(creatorUserRecordID == %@)", userId]; NSPredicate *predicate2 = [NSPredicate predicateWithFormat:@"(toUser == %@)", userId]; NSCompoundPredicate *compPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:@[predicate1, predicate2]]; CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Message" predicate

CKQueryOperation queryCompletionBlock only runs 3 times

自作多情 提交于 2019-12-01 16:13:58
I'm trying to download a batch of records from my iCloud public database using CloudKit and the cursor. The code works fine for the first 3 executions, regardless of how the resultsLimit is set, but the 4th completion block is never executed. If resultsLimit is not set I get 300 records, if it's set to 50 I get 150, if it's set to 5 I get 15... No error is reported and the block appears to be added but is never executed. Platform is OS X. Here's the code in question: let queryOp = CKQueryOperation(query: query) queryOp.recordFetchedBlock = self.fetchedDetailRecord queryOp.resultsLimit = 5

Field '___recordID' is not marked queryable

匆匆过客 提交于 2019-12-01 15:58:10
I try to download all record with a specific recordType that recordID is not matches with a certain one. But I get an error. Any idea? I thought I can mark as queryable only manually added fields. <CKError 0x15df2a10: "Invalid Arguments" (12/2015); server message = "Field '___recordID' is not marked queryable"; uuid = ECDD0C97-550F-4DD5-942D-AF4DF8917EEB; container ID = "iCloud.com.kukodajanos.Movie-Buffs"> let query = CKQuery(recordType: "UserSetting", predicate: NSPredicate(format: "recordID != %@", CKRecordID(recordName: loggedInUserRecordName!))) I found. possible to add metaindexes as

CKQueryOperation not returning error when device offline

孤街浪徒 提交于 2019-12-01 15:22:33
I am trying to use CKQueryOperation , rather then performQuery on my CloudKit database. Both work, but when using a CKQueryOperation I am not getting an error when the device is offline, but I do when using performQuery Here is the bare bones my performQuery example, database is my CKDatabase database.performQuery(q, inZoneWithID: nil) { (records:[CKRecord]?, error:NSError?) in if error != nil { print(error!.localizedDescription) return } } An error is given when the device is offline, allowing me to prompt the user. The error is The internet connection appears to be offline However, I get no

How to get CKRecord info from CKDatabaseNotification while perform changes on shared database?

孤人 提交于 2019-12-01 12:37:50
问题 This is userInfo I receive from server when change one property: [AnyHashable("aps"): { "content-available" = 1; }, AnyHashable("ck"): { ce = 2; cid = "iCloud.pl.blueworld.fieldservice"; met = { dbs = 3; sid = "E93874B3-53B4-4CD7-83A0-157DDE3B1094"; zid = fieldservice; zoid = "_c42e727205f9a1c05eab6df6298d51ca"; }; nid = "46a3d259-11c5-4212-9bef-b9aef4ea5bf8"; }] I can quickly create object: CKNotification(fromRemoteNotificationDictionary: userInfo) but now how can I receive its record ID? I

iOS, CloudKit - do I need to do a fetch when my app starts?

岁酱吖の 提交于 2019-12-01 07:32:10
I'm setting up registrations for notifications of iCloud changes. Say a new device is added to the icloud account, I'm just wondering how that device will get the private database records. Do I need to do a one off query? I'm hoping that notifications will be used at all other times. Thunk Let's start with some relevant characteristics of subscription notifications: First: Subscription Notifications are specific to a user + device pair. If I install you app on my phone, I start getting notifications. I won't get the notifications on another device until I install the app there, too. Second:

iOS, CloudKit - do I need to do a fetch when my app starts?

泪湿孤枕 提交于 2019-12-01 05:08:59
问题 I'm setting up registrations for notifications of iCloud changes. Say a new device is added to the icloud account, I'm just wondering how that device will get the private database records. Do I need to do a one off query? I'm hoping that notifications will be used at all other times. 回答1: Let's start with some relevant characteristics of subscription notifications: First: Subscription Notifications are specific to a user + device pair. If I install you app on my phone, I start getting

Why can't I use subscripting on a CKRecord object in swift?

若如初见. 提交于 2019-12-01 05:06:26
问题 This has bothered me for a little while. Is there a reason why I need to do this to set an object on a CKRecord. task.record?.setObject(task.reference, forKey:ReferenceField) instead of this task.record?[ReferenceField] = task.reference From what I read in the docs CKRecord should be subscript friendly 回答1: That subscripting is only available from Objective-C, since it's implemented using objectForKeyedSubscript: and setObject:forKeyedSubscript: . Happily, it's easy to extend CKRecord to

Any way to debug app with dataset in production environment?

会有一股神秘感。 提交于 2019-12-01 04:05:12
问题 My CloudKit dataset in Production Environment is somewhat bigger than Development , and other exotic difference could exist. There is a nasty deadlock using my app in Production Mode. Is it possible to debug client in any way? Or should I log as many thing as possible and send somehow out? It is a threading issue, so without examining threads in Xcode it is really though to do anything. Any idea? I am using Core Data to local storage. 回答1: Rollback changes in the source code, to be able to

The application is missing required entitlement com.apple.developer.icloud-services'

痴心易碎 提交于 2019-12-01 03:13:43
I'm using a public iCloud database in my app, which works great and is up on the store. On updating my app to a new version (with Xcode 7 on iOS9) I get a crash on the line : CKContainer * container = [CKContainer containerWithIdentifier:@"iCloud.com.identifier"]; *** Terminating app due to uncaught exception 'CKException', reason: 'The application is missing required entitlement com.apple.developer.icloud-services' This happens ONLY the first launch of the app after updating, and only on iOS9. After that first (update) launch, the app launches and iCloud works as expected. I can recreate the