Finutv
Finutv

Reputation: 341

how to call a function in a secondary thread with interval?

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

Upvotes: 1

Views: 182

Answers (2)

Thomas Zoechling
Thomas Zoechling

Reputation: 34253

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().

Upvotes: 2

iamsult
iamsult

Reputation: 1579

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?

Upvotes: 1

Related Questions