gpt4 book ai didi

ios - 从 NSDictionary 访问 xml 值

转载 作者:行者123 更新时间:2023-11-29 03:55:31 24 4
gpt4 key购买 nike

我正在使用this xmlreader 。这是我的代码

NSDictionary *xmlDict = [XMLReader dictionaryForXMLString:responseString error:&error1];
NSLog(@"XMLData: %@",xmlDict);

我可以保存并记录数据,它看起来像这样。

response =     {
Gpn0 = {
text = 10000;
};
Gsn0 = {
text = 4;
};
btn0 = {
text = up;
};
};
}

但是我怎样才能从这个字典中访问单个元素呢?

最佳答案

NSDictionary *gpn0 = response[@"Gpn0"];
NSNumber *gpn0_text = gpno[@"text"]; // note this is a numeric value

NSDictionary *btn0 = response[@"btn0"];
NSString *btn0_text = gpno[@"text"]; // note this is a string value

so on and so forth

关于ios - 从 NSDictionary 访问 xml 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16551929/

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