ios - CloudKit not returning the most recent data -
i having issue save icloud using cloudkit fetching results doesn't homecoming latest info inserted.
example
let todorecord = ckrecord(recordtype: "todos") todorecord.setvalue(todo, forkey: "todotext") publicdb.saverecord(todorecord, completionhandler: { (record, error) -> void in nslog("saved in cloudkit") allow predicate = nspredicate(value: true) allow query = ckquery(recordtype: "todos", predicate: predicate) self.publicdb.performquery(query, inzonewithid: nil) { results, error in if error != nil { dispatch_async(dispatch_get_main_queue()) { self.delegate?.errorupdating(error) homecoming } } else { nslog("###### fetch after save : \(results.count)") dispatch_async(dispatch_get_main_queue()) { self.delegate?.modelupdated() homecoming } } }
result :
before saving in cloud kit : 3 cloudkit[22799:882643] saved in cloudkit cloudkit[22799:882643] ###### count after save : 3
am missing here guys?
there delay between when record saved in cloudkit , when indexes have been updated values record.
when ckmodifyrecordsoperation
completes able fetch record via record identifier.
however, there delay while record added search indexes on server , queries won't find record immediately.
if you're using ckquery
view you'll want maintain side table of records have been modified locally , stitch view until query starts returning record.
ios icloud cloudkit icloud-api
No comments:
Post a Comment