我有以下代碼:不能從NSDictionary的
- (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary {
self = [super init];
if (self != nil) {
dictionaryRepresentation = [dictionary retain];
NSArray *allKeys = [dictionaryRepresentation allKeys];
NSDictionary *k = [dictionaryRepresentation objectForKey:[allKeys objectAtIndex:[allKeys count] - 1]];
NSArray *stepDics = [k objectForKey:@"Steps"];
numerOfSteps = [stepDics count];
steps = [[NSMutableArray alloc] initWithCapacity:numerOfSteps];
for (NSDictionary *stepDic in stepDics) {
[(NSMutableArray *)steps addObject:[UICGStep stepWithDictionaryRepresentation:stepDic]];
}
............
}
我的應用程序崩潰,在這條線:
NSArray *stepDics = [k objectForKey:@"Steps"];
也崩潰,如果我試試這個:NSArray *stepDics = [k objectForKey:@"pr"];
。它似乎我無法使用任何密鑰!
這是我的字典的樣子: http://pastebin.com/w5HSLvvT
任何想法?