NSMutableDictionary正在为键和值添加引号-为什么? [英] NSMutableDictionary is adding quotes to keys and values - why?
问题描述
我正在尝试使用以下方法向NSMutableDictionary中添加一些其他键/值对:
I'm trying to add some additional key/value pairs to an NSMutableDictionary, using:
Tag *tag1 = [results1 objectAtIndex:0];
[resultsDict setObject:[tag1 retrieveTextUpToDepth:1] forKey:@"image_url"];
Tag *tag2 = [results2 objectAtIndex:0];
[resultsDict setValue:[tag2 retrieveTextUpToDepth:1] forKey:@"majority"];
这毫无疑问地添加了k/v对,除了当我检索它们时,某些值已经用双引号引起来了:
This adds the k/v pairs with no problem, except when I come to retrieve them, some of the values have been wrapped with double quotes:
po extendedDataDictionary:
"image_url" = "/images/mpsL/11727.jpeg";
majority = 3460;
键和值都是NSString,不带引号-因此,我很困惑它们的出现位置.
Both keys and values are NSStrings, with no quotes - so I'm stumped as to where they're appearing from.
有什么办法可以防止这种情况?
Is there any way of preventing this?
还是我必须忍受它,并在检索到值后尝试删除引号?
Or am I going to have to live with it and try to strip off the quotes once I've retrieved the value?
谢谢...
推荐答案
引号实际上不是内容的一部分; -description
方法(由IIRC称为po
)只是将内容包装在引号中以供显示,这些引号中包含非字母数字字符.
The quotes aren't really part of the content; the -description
method (called by po
, IIRC) simply wraps things in quotes for display that have non-alphanumeric characters in them.
这篇关于NSMutableDictionary正在为键和值添加引号-为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!