objective c - CloudKit Query Time -


I just started trialling CloudKit and some very slow query times are happening. Here are some sample code I am using:

  // CLOUDKIT CKContainer * container = [CKContainer defaultContainer]; CkDB Base * PrivateDatabase = [Container Private Cloud Database]; NSPredicate * predicate = [NSPredicate predicateWithFormat: @ "TRUEPREDICATE"]; CKQuery * query = [[CKQuery alloc] initWithRecordType: @ "FlightLog" predicate: predicate]; [PrivateDatabase performQuery: Query inZoneWithID: completionHandler zero: (! Error) ^ (NSArray * result, NSError * error) {// success if {UIAlertView * warning = [[UIAlertView alloc] initWithTitle: @ "Success" message: @ "IT Worked "representative: cancel selfTuttonite: @" sack "other button titles: zero]; [Alerts show]; NSLog (@ "% @", @ "Fetch Flight Success!"); NSLog (@ "% @", auto reset); Self.fetchedRecords = Results; [Self.tableViewReloadData]; } // another error {UIAlertView * warning = [[UIAlertView alloc] initWithTitle: @ "error" message: error.localizedDescription Representative: auto-cancelButtonTitle: @ "dismissed" otherButtonTitles: zero]; [Alerts show]; NSLog (@ "% @", error); }}];   

Let me get the personal database, and for all the records there are just four simple people dashboards on this code I called.

Added, I can see from my console log with a null result array that the success message is called almost immediately. In later moments, the results are returned, as seen in the log. However, the alert view is not shown and the result displayed in my table for about 3-4 seconds

What's going on ?!

Thank you.

After "text" itemprop = "text">

took the resolution. As Edwin mentions, I did not know that the callback is on a background thread. So when I call [self.tableView reloadData] ), it is also running on the background thread.

By putting it back on the main thread, the table view again reloads in one second, running on the same thread in the callback form, then taking approximately 4-5 seconds vs.

  dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {dispatch_async (dispatch_get_main_queue (), ^ {[self.tableView reloaded data];});});   

I know that I have misunderstood, but thats what I think has happened.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -