title: Non-blocking wait function in Objective-C
body: <p>I'm fairly new to Objective-C and I can't figure out how to wait in a non-blocking manner.  I have an object that is being populated asynchronously and I need to wait on it before I can proceed in another method.  Right now I am using the sleep function, but this blocks the whole app and myObject never gets loaded.</p>
  
  <pre><code>while (!myObject)
  {
      sleep(1);
  }
  return myObject;
  </code></pre>
  
  <p>EDIT: This code snippet is from a method that may be called before myObject has been loaded.  In this case I actually do want to block in this method, but my code blocks everything including myObject from being loaded.</p>