我有一组uilocalnotification对象,需要根据uilocalnotification的userinfo属性(nsdictionary)中的键进行排序。我知道如何按一个级别深的值对nsarray进行排序,例如,nsdictionary数组中的键,但我会丢失两个级别深的值。我想做这样的事情,这是psuedo代码:
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];