Aleksander Azizi
Aleksander Azizi

Reputation: 9867

sleepForTimeInterval Timeout freezes app

I'm trying to wait X amount of seconds in between actions. When using [NSThread sleepForTimeInterval:3.0]; the app freezes for the set amount of time. How can I timeout without disrupting the main thread?

Upvotes: 0

Views: 726

Answers (1)

Joshua Nozzi
Joshua Nozzi

Reputation: 61228

You can't block the main runloop (which handles user input) and expect your app to remain responsive. Consider using an NSTimer.

Upvotes: 1

Related Questions