Questions tagged [ckquery]

CKQuery is a component of the cloudkit iOS Developer Library. A CKQuery object manages the criteria to apply when searching for records in a database.

CKQuery is a component of the cloudkit iOS Developer Library. A CKQuery object manages the criteria to apply when searching for records in a database.

You create a query object as the first step in the search process. The query object stores the search parameters, including the type of records to search, the match criteria (predicate) to apply, and the sort parameters to apply to the results. The second step is to use the query object to initialize a CKQueryOperation object, which you then execute to generate the results.

Available in iOS 8.0 and later.

Read the official reference for further details

81 questions
1
vote
1 answer

CKQueryOperation iOS 9 only work plugged in

I am using CloudKit in my iOS 9 app and I have a CKQueryOperation that work fine and performs as expected when plugged into the Mac. As soon as the query is run when it is not plugged in to the Mac, it does not finish. There is no error message, the…
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82
1
vote
2 answers

CloudKit - CKQueryOperation results different each time the same query is ran

This is the case - I'm using a simple UITableView that renders records from the CloudKit publicDB. When I run the app, the query operation returns for example returns 2 results (that's all it has currently). My table view has a refresh control and…
peerless
  • 558
  • 3
  • 11
1
vote
2 answers

CloudKit : CKQuery showing error: error: The operation couldn’t be completed. (CKErrorDomain error 1.)

I working on iOS app implementing cloudkit but I need to query all the records with ID greater then a number. For example I have record with ID of 23: here is my code: CKContainer *myContainer = [CKContainer containerWithIdentifier:containerID]; …
user2924482
  • 8,380
  • 23
  • 89
  • 173
1
vote
1 answer

How to keep data from iCloud(CloudKit) loaded after switching view controllers

I am in the process of making an app using CloudKit, but I have recently run into a problem. In my app, as soon as the main view controller loads, it goes off and fetches data from iCloud. The problem is that when I segue to another view controller…
traw1233
  • 1,895
  • 2
  • 12
  • 12
1
vote
2 answers

CloudKit: Query the index ( recordID.recordName )

I'm trying to figure out how to query the index of my records in cloudkit using Objective-C. I build a query to fetch all my records: CKContainer *container = [CKContainer containerWithIdentifier:containerID]; CKDatabase *publicDatabase = [container…
user2924482
  • 8,380
  • 23
  • 89
  • 173
0
votes
1 answer

How to do CloudKit Query Operations in iOS 16+?

CKQueryOperation recordFetchBlock and queryCompletionBlock have been deprecated. How would I complete this operation now? queryOperation.recordFetchedBlock = { record in if let location = record["location1"] as? CLLocation { var…
Steve
  • 1,121
  • 1
  • 12
  • 32
0
votes
1 answer

Get Newest Record from CloudKit Database

I'm new to CloudKit (and haven't used NSPredicate much) and am looking to do something which, I'd imagine, is quite basic. I'd like to retrieve the data record with the newest creationDate. Right now I'm just pulling all the records and scooping up…
Rogare
  • 3,234
  • 3
  • 27
  • 50
0
votes
1 answer

How to setup the completion handler for fetch(withQuery: , inZoneWith: ) cloudKit func

I'm working on a store management system that uses cloudKit to store the users data. I have custom zones set up within the private database with some pre populated data. I have the func loadCustomerArray() which should retrieve all records within…
JonGrimes20
  • 115
  • 9
0
votes
1 answer

CKQuery -Specific Field with Specific Value

How can I query for this field myId with this specific id -MqXU-kKVhl5ef10XD post: let database = CKContainer(identifier: "iCloud.com.myCo.myApp").publicCloudDatabase let record = CKRecord(recordType: "Sample") record["myId"] =…
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
0
votes
2 answers

CloudKit Query with modificationDate Always Returns No Results

My goal is to get User records from CloudKit I specify in an array of CKRecord.IDs, but only if they were updated more recently than my last updated date which I track locally. I'm doing the following CloudKit query: var predicate:NSPredicate if…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
0
votes
0 answers

iCloud - Sending CKQuery results into a TableView

I've written this model swift file class and runs when calls without errors but doesn't fill any record field data into into the resultsValueArray array. What am I missing here? import Foundation import CloudKit class TeamDataLoad { let container…
BrianN
  • 1
0
votes
1 answer

How to fetch CKRecords without parent record?

I need to check which CKRecords in CloudKit container don't have parent record yet. How I can fetch only records that do not have parent yet? I've tried NSPredicate, but getting an error "Unknown field 'parent'".
bodich
  • 1,708
  • 12
  • 31
0
votes
1 answer

Can I sort CKRecord's when queried by a user entered Date/Time field?

I am saving multiple fields in different records in CloudKit. When I query the records I currently have them sorted by creation date. Am I able to sort these records by the Date/Time fields I have my users save to the record and not by the creation…
BlueBulls
  • 11
  • 2
0
votes
1 answer

Why will my CKQueryOperation only return a Cursor if the results limit is less than 1000?

CloudKit has about 2000 records that I am attempting to download. I cannot get all of them to download, I looked at CloudKit CKQueryOperation doesn't get all records to get more than 100 results. Now I can get upto 999 to download, but if I set the…
Kevin
  • 1
  • 2
0
votes
0 answers

Cloudkit query array size == 0

I'm performing query operation with Cloudkit, my record type is like this: CKRecord Type: Person { name STRING, age INTEGER, friends ARRAY, } Now, I want to query all person with no friends.I have tried NSPredicate *predicate =…
Ray
  • 272
  • 2
  • 13