Getting background data in the background

I have a navigation view with a table view, when a row is clicked, the indexPath row is passed to the next view.

in the Details viewDidLoad, I get data from Core Data. I am using select from application delegate

[appDelegate loadItem:i];

As you can see, I am missing a single integer that carries a line number.

the question arises: How can I make this call process in another thread (in the background) I need this because sometimes the result of the selection is too large, so processing takes 3 seconds, pushing away the view of the information.

I need to display an activity indicator in three seconds, so I need to put Fetch in another thread in order to be able to use the user interface for the indicator during processing of the selection.

I need the easiest way since I'm a beginner. Posting some codes will be great. or links :)

+3
source share
1 answer

Mixing multithreading and master data is no easy task. The “Multi-Threading with Core Data” section of the Master Data Programming Guide describes how to interact with master data across multiple threads, including all the things you need to be careful about.

, . . :

. . ( , , ), ( objectWithID: ).

, BackgroundFetching , , .

, , , . -setFetchBatchSize: NSFetchRequest, , ( ). -setPropertiesToFetch: , , .

+15

Source: https://habr.com/ru/post/1722838/


All Articles