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.
I've seen many questions regarding this issue but none of them worked for me.
The project has (for now) 3 files:
main.cpp
AppController.h
AppController.m
here is a snip of the relevant code: http://pastebin.com/g4cKYPkm
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.
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.
I added a loop right after the call to startQuery
//Psuedo code
while query.isGathering == YES {
print query.isStarted
print query.isGathering
print query.isStopped
print query.operationQueue.operationCount
print query.resultCount
wait 10sec
}
and I get that the query started ,it's gathering , it's not stopped and both result and the queue sizes are 0.
Any idea what I'm doing wrong? any idea how more to analyze the problem? thank you.
EDIT: I work with Qt Creator, I tried the same code with XCode but no luck :(