tags:

views:

47

answers:

1

Hello All,

I have one problem, i want to save the rss data coming from xml into local database but it takes from time because it contain images and i also save images in resource path. so how can i parse and save data at same time? it take lots of time so is there any method that runs on background?

for eg: i will load all data from the xml into an array and display in to tableview after that on background the array will save data in database?

Thank You.

A: 

Use the -detachNewThreadSelector:toTarget:withObject: method to run code in a background thread:

[NSThread detachNewThreadSelector:@selector(doStuffInBackgroundThread) toTarget:self withObject:nil]

If you use the libxml framework, as you parse each XML node of interest, once the parse is complete, you can then fire off a selector on a separate thread to add the data to a database or Core Data store.

Take a look at Apple's XMLPerformance sample project for more information.

Alex Reynolds