ckquery

How to query CloudKit for recordID IN [CKRecordID]

扶醉桌前 提交于 2019-12-20 12:38:45
问题 My predicate wants to exclude some records that are already downloaded and available in a [CKRecordID]. Now I can query 1 CKRecordID[0], but not the [CKRecordID] array. How can I query the array? let excludeIDs: [CKRecordID] This works: let pred1 = NSPredicate(format: "NOT(recordID = %@)", excludeIDs[0]) But this doesn't: let pred1 = NSPredicate(format: "NOT(recordID IN %@)", excludeIDs) ERROR: loadImageCompareRecordIDsAndEndDateThatHaveNotEnded Error: Invalid predicate: Invalid predicate:

Limit the amount of results returned in CloudKit

一笑奈何 提交于 2019-12-18 16:34:10
问题 Is there any way to limit the amount of results that are returned in a CKQuery ? In SQL , it is possible to run a query like SELECT * FROM Posts LIMIT 10,15 . Is there anything like the last part of the query, LIMIT 10,15 in CloudKit? For example, I would like to load the first 5 results, then, once the user scrolls down, I would like to load the next 5 results, and so on. In SQL, it would be LIMIT 0,5 , then LIMIT 6,10 , and so on. One thing that would work is to use a for loop, but it would

How do I get a list of RecordTypes in a Database?

为君一笑 提交于 2019-12-13 03:59:45
问题 I want to list all records in a Database. To do this using CKQuery, it appears I must have a recordType. The predicate will be TRUEPREDICATE. How can I get a list of RecordTypes, for eventual use within CKQuery? (e.g. I'll loop through the list, and create new CKQuery objects at run time.) 回答1: As strange as it may seem, there is no way to determine what record types exist in a Cloud Kit database. Your code should be creating records with specific record types so your code should already know

CloudKit CKQueryOperation doesn't get all records

白昼怎懂夜的黑 提交于 2019-12-05 02:34:09
问题 In CloudKit RecordType is more than 100 records. Following code gets from these only 11 and they are not first 11 records, they are picked randomly from beginning, center and at the end of records. I can't get whats wrong in code. EDIT : I got it working by changing .reseltsLimit to 5000! let cloudContainer = CKContainer.default() let publicDatabase = cloudContainer.publicCloudDatabase let predicate = NSPredicate(value: true) let query = CKQuery(recordType: "Sijainti", predicate: predicate)

CloudKit CKQueryOperation doesn't get all records

自古美人都是妖i 提交于 2019-12-03 20:23:43
In CloudKit RecordType is more than 100 records. Following code gets from these only 11 and they are not first 11 records, they are picked randomly from beginning, center and at the end of records. I can't get whats wrong in code. EDIT : I got it working by changing .reseltsLimit to 5000! let cloudContainer = CKContainer.default() let publicDatabase = cloudContainer.publicCloudDatabase let predicate = NSPredicate(value: true) let query = CKQuery(recordType: "Sijainti", predicate: predicate) var queryOperation = CKQueryOperation(query: query) queryOperation.queuePriority = .veryHigh

How to query CloudKit for recordID IN [CKRecordID]

為{幸葍}努か 提交于 2019-12-03 03:04:24
My predicate wants to exclude some records that are already downloaded and available in a [CKRecordID]. Now I can query 1 CKRecordID[0], but not the [CKRecordID] array. How can I query the array? let excludeIDs: [CKRecordID] This works: let pred1 = NSPredicate(format: "NOT(recordID = %@)", excludeIDs[0]) But this doesn't: let pred1 = NSPredicate(format: "NOT(recordID IN %@)", excludeIDs) ERROR: loadImageCompareRecordIDsAndEndDateThatHaveNotEnded Error: Invalid predicate: Invalid predicate: Array members must conform to CKRecordValue: ( "", "", "", "", "" ) (CKRecordID) The other general parts

CloudKit compound query (query with OR)

喜夏-厌秋 提交于 2019-12-01 17:41:42
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:compPredicate]; But unfortunately CKQuery does not support OR query (as written in documentation) Can I achieve

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

Limit the amount of results returned in CloudKit

寵の児 提交于 2019-11-30 14:04:10
Is there any way to limit the amount of results that are returned in a CKQuery ? In SQL , it is possible to run a query like SELECT * FROM Posts LIMIT 10,15 . Is there anything like the last part of the query, LIMIT 10,15 in CloudKit? For example, I would like to load the first 5 results, then, once the user scrolls down, I would like to load the next 5 results, and so on. In SQL, it would be LIMIT 0,5 , then LIMIT 6,10 , and so on. One thing that would work is to use a for loop, but it would be very intensive, as I would have to select all of the values from iCloud, and then loop through them

CKQuery from private zone returns only first 100 CKRecords from in CloudKit

眉间皱痕 提交于 2019-11-26 16:36:17
问题 Is there any limit to the result of a query to Cloudkit private default zone? I have no clue why I only receive first 100 records with the following query: let p = NSPredicate(format: "(type == 'entered') AND (timestamp >= %@) AND (timestamp <= %@)", from, to) let q = CKQuery(recordType: self.beaconRecordType, predicate: p) q.sortDescriptors = [NSSortDescriptor(key: "timestamp", ascending: true)] self.privateDatabase?.performQuery(q, inZoneWithID: nil, completionHandler: { results, error in /