Instance Method


Runs the loop once or until the specified date, accepting input only for the specified mode.


- (void)acceptInputForMode:(NSRunLoopMode)mode beforeDate:(NSDate *)limitDate;



The mode in which to run. You may specify custom modes or use one of the modes listed in Run Loop Modes.


The date up until which to run.


If no input sources or timers are attached to the run loop, this method exits immediately; otherwise, it runs the run loop once, returning as soon as one input source processes a message or the specifed time elapses.

Manually removing all known input sources and timers from the run loop is not a guarantee that the run loop will exit. macOS can install and remove additional input sources as needed to process requests targeted at the receiver’s thread. Those sources could therefore prevent the run loop from exiting.

See Also

Running a Loop

- run

Puts the receiver into a permanent loop, during which time it processes data from all attached input sources.

- runMode:beforeDate:

Runs the loop once, blocking for input in the specified mode until a given date.

- runUntilDate:

Runs the loop until the specified date, during which time it processes data from all attached input sources.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software