You need to run a run loop in your thread. See: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html
Topic:
App & System Services
SubTopic:
General
Tags: