• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting NSMetadataQuery to sort properly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting NSMetadataQuery to sort properly


  • Subject: Getting NSMetadataQuery to sort properly
  • From: Tom Birch <email@hidden>
  • Date: Tue, 28 Jun 2005 01:29:47 +1000

I'm trying to use an NSMetadataQuery to get a list of PDF's on my system and sort them by path name, yet when I try this, they are definitely not in sorted order

here is the relevant code:

----
query = [[NSMetadataQuery alloc] init];

[query setPredicate: [NSPredicate predicateWithFormat:
@"kMDItemContentType == \"com.adobe.pdf\""]];
[query setSortDescriptors:
[NSArray arrayWithObject:
[[NSSortDescriptor alloc] initWithKey:@"kMDItemPath" ascending:YES]
]
];
----


After receiving the notifcation (which is registered for just after this code) the items are in apparently unsorted order, ie items with path starting with "/Users" exist at index 1100 and 1500, whilst an item with path starting with "/Applications" exists at index 1330

Is there some special magic I have to do because NSMetadataItem isn't KVC compliant? I really have no idea why this isn't getting sorted.

Tom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Getting NSMetadataQuery to sort properly
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: Re: detect command key status
  • Next by Date: Re: Not drawing NSTableView rows as selected?
  • Previous by thread: Non-activating panel problem
  • Next by thread: Re: Getting NSMetadataQuery to sort properly
  • Index(es):
    • Date
    • Thread