2010-07-02 3 views
0

나는 NSDictionary 인 UILocalNotification의 userInfo 속성 내의 키에 따라 정렬해야하는 UILocalNotification 객체의 NSArray를가집니다. NSArrays를 NSDictionaries의 배열 내에서 키와 같이 한 단계 깊은 값으로 정렬하는 방법을 알고 있지만 두 단계는 손실됩니다. 이 코드는 다음과 같이하고 싶습니다.2 수준의 키 - 값 관계로 NSArray 정렬

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]; 

답변

1

코드를 사용해 보셨습니까? Apple의 문서 (here)는 키가 아닌 주요 경로를 허용한다고 말합니다.

+0

어딘가에서 그 도트 구문을 기억하고 있다고 생각했습니다! –