【发布时间】:2012-05-23 11:42:33
【问题描述】:
这是我获取 json 响应字符串的代码
我通过这个方法得到这个字符串
NSDictionary *selector = [json valueForKey: @"Title"];
NSMutableArray *dictArray = [[NSMutableArray alloc] initWithObjects: selector,nil];
str1=[[dictArray objectAtIndex:i] valueForKey:@"CompanyName"];
打印“str1”
我来了
(
"hello@developer.com"
),
(
"hello@developer.com",
"helloworld@microsoft.com"
),
(
"hello@developer.com"
),
(
"hello@developer.com"
),
(
"hello@developer.com"
),
(
"hello@developer.com"
),
(
"hello@developer.com"
),
(
"hello@developer.com"
)
)
我正在尝试使用“,”运算符存储在数组中
喜欢这样
NSArray *SplitStringArray = [str1 componentsSeparatedByString:@", "];
但我没有将字符串拆分为元素数组
谁能帮帮我?
【问题讨论】:
-
顺便说一句,这不是您解析 json 数据的方式。看看这个答案:stackoverflow.com/a/5813223/986169
-
确实如此。我推荐 JSONKit:github.com/johnezang/JSONKit
标签: ios xcode json nsmutablearray nsdictionary