Ios – What’s the equivalent of Java’s Thread.sleep() in Objective-C/Cocoa


In Java you can suspend the current thread's execution for an amount of time using Thread.sleep(). Is there something like this in Objective-C?

Best Solution

Yes, there's +[NSThread sleepForTimeInterval:]

(Just so you know for future questions, Objective-C is the language itself; the library of objects (one of them at least) is Cocoa.)