Issue with quering cloudkit after saving records

In the app I am working on, which is a translation app, I have a database in cloudkit with words (in two different languages). I query the database for a random set, for me to give the correct translation. Depending on my response (correct or not correct) I update the record and save it back to the database. Then I do a new query for a new random set of words.
But sometimes, although I saved the record correctly, the record does not show up with the new query.
I guess there is a time before a record is searchable again (indexing ?).
Any ideas on how to solve this issue ? Much appreciated.


@nixxe Do you still have issues with this?

Yeah I cannot resolve it properly.
Guess there is some delay before a record is searchable, but I find no documentation about this.
I cannot believe nobody come across this issue.
Finally I check the result of the query, when it is incorrect I stop the app with an error message and ask the user to run a new query (= next button). Second query never gives an error. But this is not a nice solution.

@nixxe Please check out our CloudKit tutorial when you get a chance:

I hope it helps!


your reply made me look at it again

this is how its running now

  • first I do the save operation, with a completion block
  • next I do the query operation but with a
    DispatchQueue.main.asyncAfter(deadline : .now() + .milliseconds(1500))

this gives a delay of 1.5 seconds before running thequery, it worked until now

This topic was automatically closed after 166 days. New replies are no longer allowed.