我有一个Uilocalnotification对象的NSARRAY,我需要根据Uilocalnotification的UserInfo属性中的密钥进行排序,这是Nsdictionary。我知道如何按一个深度的值对nsarrays进行排序,例如,在一系列nsdictionaries中的钥匙,但是我迷失了两个级别。我想做这样的事情是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];
有帮助吗?

解决方案

您尝试过代码吗?苹果的文件(这里)说它接受关键途径,而不仅仅是钥匙。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top