I’m using chcsvparser to parse data from a csv file on my apps launch. It’s taking way too long to startup on main thread so I was thinking of doing this on the background thread. But I read that you can’t pass objects between the threads. The parser outputs an NSArray so is there a way to do this? I’ve also read that you shouldn’t change UI from background thread but this array will load a table view.
Share
The NSObject class has several different instance methods that allow you to invoke methods on the main UI thread. The performSelectorOnMainThread:withObject:waitUntilDone: method, for instance, allows you to invoke a method of the receiver on the main thread with the object of your choice.
Here’s some code to get you started: