Yozone W.
Yozone W.

Reputation: 303

UI blocked while NSFetchedResultsController loading data

I managed UITableView via NSFetchedResultsController, but all UI blocked(I can do nothing such as tap, scroll...) while NSFetchedResultsController loading data. Is there any solution to resolve this? Thanks!!!

Upvotes: 1

Views: 710

Answers (1)

msgambel
msgambel

Reputation: 7340

One thing that is important to remember when making your application user friendly is:

If you have any intensive, non-UI related computations on the Main Thread, you are doing something wrong!

Making the Main Thread UI only will make sure that the UI will never freeze, or as you describe it, get "blocked". Therefore, your NSFetchedResultsController should be on another thread, to ensure that this doesn't happen.

NSOperation's is definitely the way to go for the problem you are describing. Here is a tutorial and sample code which will explain a similar scenario, and how to fix it up.

Hope that Helps!

Upvotes: 1

Related Questions