1

Is there a way to do a Spotlight query, in Obj-C, similar to what mdfind does? I need to write a method with the following signature:

-(NSString *)mdfind:(NSString *)theFileToLookFor

where the returned NSString is the first path found by the search.

Any help will be really appreciated.

Community
  • 1
  • 1
user732274
  • 1,069
  • 1
  • 12
  • 28
  • [Check this answer][1] [1]: http://stackoverflow.com/questions/7674688/mac-spotlight-api-how-to-search-emails-to-from-or-subject-fields – Vassilis Dec 30 '11 at 05:11

2 Answers2

2

NSMetadataQuery is the wrapper around the Carbon-level MDQuery API, which is how one interacts with the user's spotlight database.

Dave DeLong
  • 242,470
  • 58
  • 448
  • 498
0

the apis are in CoreServices.framework. start with the ones which have the prefix MDQuery

justin
  • 104,054
  • 14
  • 179
  • 226