title: Spotlight API (NSMetadataQuery ) not returning results
body: <p>I'm trying to work with the NSMetadataQuery in a C++\Qt project and I got it to compile and run but I only get the NSMetadataQueryDidStartGatheringNotification.</p>
  
  <p>I've seen many questions regarding this issue but none of them worked for me.</p>
  
  <p>The project has (for now) 3 files:</p>
  
  <pre><code>main.cpp
  AppController.h
  AppController.m
  </code></pre>
  
  <p>here is a snip of the relevant code:
  <a href="http://pastebin.com/g4cKYPkm" rel="nofollow">http://pastebin.com/g4cKYPkm</a></p>
  
  <p>I wrote it twice, this version is a copy paste from the apple example "spotlighter" minus the code needed for GUI (my project is a console project) and both times I got the same result.</p>
  
  <p>Many of the answers say that I need to run the startQuery in the mainThread , I have only one thread and I used [NSThread isMainThread] to see if I'm actually running on the mainThread.</p>
  
  <p>I added a loop right after the call to startQuery </p>
  
  <pre><code>//Psuedo code
  while query.isGathering == YES {
      print query.isStarted
      print query.isGathering
      print query.isStopped
      print query.operationQueue.operationCount
      print query.resultCount
      wait 10sec
  }
  </code></pre>
  
  <p>and I get that the query started ,it's gathering , it's not stopped and both result and the queue sizes are 0.</p>
  
  <p>Any idea what I'm doing wrong? any idea how more to analyze the problem? thank you.</p>
  
  <p>EDIT: I work with Qt Creator, I tried the same code with XCode but no luck :(</p>