2

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 :(

ManicQin
  • 159
  • 1
  • 8
  • 1
    https://stackoverflow.com/a/47705393/3170912 – iwolf Dec 08 '17 at 17:00
  • You are a hero ... unfortunately I have changed jobs years ago and can't test if it's actually working. Still, big thank you for trying to better the community. – ManicQin Dec 11 '17 at 09:02

0 Answers0