title: Developing a non-GUI user agent in Objective-C using NSDistributedNotificationCenter
body: <p>I would like to create a user agent in Objective-C that listens for notifications from the default <code>NSDistributedNotificationCenter</code>. The agent will not have a GUI. When I create a Cocoa application (I will also be using Distributed Objects, which I think is only in Cocoa) in Xcode, however, Xcode sets the project as a GUI application.</p>
  
  <p>In the main function, I remove the <code>NSApplicationMain(...)</code> function call to remove the GUI elements from the application. However, now I can't get the thread to wait (listen for) notifications coming in from the <code>NSDistributedNotificationCenter</code>. The app just starts and quits immediately.</p>
  
  <p>I looked into using the <code>NSRunLoop</code> from the current <code>NSThread</code>, however, it seems that <code>NSRunLoop</code>s only wait on <code>NSPort</code>s. There's no mention of waiting on <code>NSNotifications</code>.</p>