简体   繁体   中英

Cloudkit Query Time -

I have a question about CloudKit query times. I have two tab views. One is a regular view with a picture and two labels and the other is a table view. When clicked, it'll go to a details page. I'm querying information for both tab views.

This app is for upcoming events and normal events.

Anyways, the regular view (ie non table view) takes about 15 seconds for the information to load. The table view takes 2-3 seconds. I'm wondering why. The conclusion I've been able to settle on so far (after reading numerous posts) is that the table view has:

                dispatch_async(dispatch_get_main_queue(), { () -> Void in
                    println("Reloading data in tableView")
                    self.tableView.reloadData()
                })

And the regular view doesn't. However, I can't find out what I'm supposed to write that is the reloadData equivalent.

Can anyone please help shed light on this for me? It's been driving me nuts.

Thanks in advance

Wherever you update your UI in your "regular" view controller is where you'll want to use this function as well. CloudKit queries ( I believe) are executed async, and the TableView is showing the data immediately because you're forcing the system to execute that function back on the main thread. When the query is returned in your regular view, and you use the results to update your UI, anything that has to do with UI updates should also be included in this function to get the main queue, which is where UI updates should always happen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM