I want to simulate a communication with a server. As the remote server will have some delays I want to use a background thread that has on it
[NSThr
Try create a method in your thread class called sleepThread
-(void)sleepThread
{
[NSThread sleepForTimeInterval:timeoutTillAnswer];
}
Then to make it sleep from your main thread
[self.botThread performSelector:@selector(sleepThread) onThread:self.botThread withObject:nil waitUntilDone:NO];
To send updated to your main thread from your bot thread.
dispatch_async(dispatch_get_main_queue(), ^{
[MainClass somethinghasUpdated];
});
Side Note
To create the RunLoop I think all you need to do is
// Run the Current RunLoop
[[NSRunLoop currentRunLoop] run];