I used to use plists to store my app's data, but I have decided to use UIDocument instead. The first view is a UITableView, and the corresponding UIDocument needs to be loaded before the view appears.

I load and save my data in the app's delegate, but when I load my UIDocument, it only gets loaded (on a background queue, I think) after my table view appears, causing all kinds of errors.

So, how do I load it on the main queue, so that when it's loaded program execution can continue normally? The document isn't very big (only contains data of an array of string data), and so there won't really be any performance-related issues.

有帮助吗?

解决方案

Are you using method -openWithCompletionHandler: to load the document? If this is the case, you will have to reload the table in the completion block.

The document is loaded on main thread, but later, than your table is displayed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top