0

我有一个 UILocalNotification 对象的 NSArray,我需要根据 UILocalNotification 的 userInfo 属性中的一个键进行排序,该属性是一个 NSDictionary。我知道如何通过一个深度的值对 NSArrays 进行排序,例如,NSDictionaries 数组中的一个键,但是我迷失了两个深度。我想做这样的事情是伪代码:

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"userInfo.personName" ascending:YES]; 
//the personName key within the userInfo NSDictionary property of a given UILocalNotification
NSArray *sortDescriptors = [[[NSArray alloc] initWithObjects:&sortDescriptor count:1] autorelease];
NSMutableArray *sortedArray = [[[NSMutableArray alloc] initWithArray:[[UIApplication sharedApplication] scheduledLocalNotifications]] autorelease];
[sortedArray sortUsingDescriptors:sortDescriptors];
4

1 回答 1

1

你试过你的代码吗?Apple 的文档(此处)说它接受密钥路径,而不仅仅是密钥。

于 2010-07-03T02:54:57.997 回答