Created
October 10, 2013 10:51
-
-
Save billibala/6916556 to your computer and use it in GitHub Desktop.
Call "waitForCompletion" after invoking an async method. Upon receiving notification, set "executionDate" to YES and call [runloopExpirationTimer fire]. This will "dry up" the fake run loop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)waitForCompletion { | |
runloopExpirationTimer = [NSTimer scheduledTimerWithTimeInterval:600.0 target:self selector:@selector(dumbTimerMethod:) userInfo:nil repeats:NO]; | |
while ( !executionDone ) { | |
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; | |
} | |
} | |
- (void)dumbTimerMethod:(NSTimer *)theTimer { | |
runloopExpirationTimer = nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment