Reputation: 445
I build app which call to server.
it takes for 20 seconds - 30 seconds to get reply from server, because the system we use depending to outside service (connecting to our partners system).
before i can do the next, i must wait to get results.
is there any way to set the delay time for waiting reply???
thanks in advance
Upvotes: 0
Views: 105
Reputation: 3970
I use blocks in cases like these. That way you can send your request, and only proceed with code when you get a response back.
Upvotes: 1
Reputation: 50717
Is this what you are looking for?
[self performSelector:@selector(doNext) withObject:nil afterDelay:30.0];
[NSTimer scheduledTimerWithTimeInterval:30.0 target:self selector:@selector(doNext) userInfo:nil repeats:NO];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 30.0 * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self doNext];
});
Upvotes: 1