1

I am new to multi threading in xcode for iphone. i would like to load and parse data from server in another thread and periodically. Can anyone help me?

thanks

Finutv
  • 341
  • 1
  • 4
  • 17
  • Are you sure you need threaded downloads? Most of the time runloop based asynchronous loading is a better solution. You can then still do the post-processing of that data on a different `NSOperationQueue` or `dispatch_queue_t`. – danyowdee Jan 11 '12 at 19:43

2 Answers2

2

You could use GCD event dispatch sources.
Apple's Concurrency Programming Guide includes a sample on how to setup a timer.

Their sample code runs the block on the main queue. If you want it on a background thread, you could pass a queue obtained with dispatch_get_global_queue instead of dispatch_get_main_queue().

Thomas Zoechling
  • 34,177
  • 3
  • 81
  • 112
1

You can use performSelector method, If need to have more clear idea navigate to this link iPhone: how to use performSelector:onThread:withObject:waitUntilDone: method?

Community
  • 1
  • 1
iamsult
  • 1,581
  • 1
  • 15
  • 21