这个问题已经在这里有一个答案:
- 的NSMutableDictionary被加上引号键和值-为什么? 2个回答
所以,我有一个NSMutableDictionary我填充,但不同的,当我输出的内容的NSLog,该条目中的关键和值在进入for循环出现,而最终的NSLog通话甚至不输出任何东西。 这里发生了什么??? 请帮忙! 为什么周围的条目的引号中的环路中加入???
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)