所以我有一个填充的 NSMutableDictionary,但是当我将内容输出到 NSLog 时,在 for 循环中输入的条目的键和值显示不同,最终的 NSLog 调用甚至不输出任何内容。这里发生了什么???请帮忙!为什么在 for 循环中添加条目周围的引号???
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
numberOfPhotosAsString, @"PackageFileCount",
wtID, @"wtID",
uploadType, @"type",
nil];
for (int i= 0; i < photos.count; i++)
{
NSString *finalFileName = [fileNameBase stringByAppendingFormat:@"%i", i];
[params setObject:[[fileNames objectAtIndex:i] stringByAppendingString:@".jpg"] forKey:finalFileName];
// This one doesn't do anything differently:
//[params setValue:[[fileNames objectAtIndex:i] stringByAppendingString:@".jpg"] forKey:[fileNameBase stringByAppendingFormat:@"%i", i]];
}
NSLog(@"Params: %@", params);
NSLog(@"Value: %@", [params objectForKey:@"SourceName_0"]);
NSLog 的输出(我只在 for 循环中添加了一个值:“SourceName_0”=“tbyg.jpg”,但是为什么“SourceName_0”周围的引号???这里发生的任何事情都阻止我访问该字典条目......
日志:
2012-05-09 12:38:26.448 PhotoUp[6231:707] Params: {
PackageFileCount = 1;
"SourceName_0" = "tbyg.jpg";
type = T;
wtID = "6bcb4126-4bbe-4b3d-be45-9a06cf56a22f";
}
2012-05-09 12:38:26.449 PhotoUp[6231:707] Value: (null)