NSDictionary misteries

giu*_*ppe 0 nsdictionary ios

我用过很多次:

NSMutableDictionary* temp   = [[NSMutableDictionary alloc] init];
[temp setDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:
                                            [currentEvent objectForKey:@"title"],@"titolo",
                                            [currentEvent objectForKey:@"testo"],@"testo",
                                            [currentEvent objectForKey:@"start"],@"date",
                                            [NSString stringWithFormat:@"%d",lastId],@"att_id",
                                            [currentEvent objectForKey:@"pr_id"],@"pr_id",
                                            nil]];
            NSLog(@"%@",temp);
Run Code Online (Sandbox Code Playgroud)

但这一次,日志打印出来:

2013-11-22 14:39:08.152 MyApp[93198:70b] {
    titolo = asdasda;
}
Run Code Online (Sandbox Code Playgroud)

为什么它只是一个对象?在调试器中,我可以看到currentEvent已经设置了所有kesy/objest ...

Tho*_*ers 5

方法调用

initWithObjectsAndKeys
Run Code Online (Sandbox Code Playgroud)

没有终止.如果[currentEvent objectForKey:@"testo"]为nil,则字典将忽略您之后传递的所有对象.