Mubashir Hassan Khan
Mubashir Hassan Khan

Reputation: 81

Pausing the Current function for some time iphone

Hi all im trying to pause a function so some time in the middle of execution because ill have to wait for the call back functions from GData api and get my data ready to put in that function i dont know how to do that. I am developing in Xcode 4.2 really need some help

Upvotes: 0

Views: 203

Answers (2)

Saran
Saran

Reputation: 6392

You need to consider redesigning a little bit. What ever portion of code you expect to process after callback happens, let that code called by the callback. That way it will give you the guarantee that it always executes after the callback.

Upvotes: 2

Droid
Droid

Reputation: 1089

where you want to wait your functionality write this code [self performSelector:@selector(WaitForTwoSecond) withObject:nil afterDelay:2]; and implement - (void)WaitForTwoSecond { //write your code here } this method wait for two second and after that you cant access all data and put it in appropriate place .

we can say that this function is working like in background process

Upvotes: 0

Related Questions