gpt4 book ai didi

objective-c - 为什么字符串在 NSDictionary 中显示时带有引号,而其他人却没有?

转载 作者:可可西里 更新时间:2023-11-01 04:16:36 26 4
gpt4 key购买 nike

<分区>

所以我有一个我填充的 ​​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)

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com