Wait while [NSTimer scheduledTimerWithTimeInterval…] works in function while Unit Testing

Wait while [NSTimer scheduledTimerWithTimeInterval…] works in function while Unit Testing

 
Insert the code:
 
NSDate *runUntil = [NSDate dateWithTimeIntervalSinceNow: 3.0 ];
NSLog(@”about to wait”);
[[NSRunLoop currentRunLoop] runUntilDate:runUntil];
NSLog(@”wait time is over”);
 
Just after the function call that uses NSTimer.
 
Reference:
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s