Getting NSMetadataQuery to sort properly
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