我是json的新手,我需要你的帮助.
我收到了像这样的JSON字符串:
{"network":
{
"network_id":111,
"name":"test name",
"city":"test city",
"country":"test country",
"description":"test desc"
}
}
Run Code Online (Sandbox Code Playgroud)
我如何处理这个字符串并拆分键/值以便在我的视图中使用它们?
- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
NSString *responseString = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];
self.responseData = nil;
//*********** How I can parse responseString *********//
[networkIDLabel setText:@"ADD THE VALUE"];
[nameLabel setText:@"ADD THE VALUE"];
[responseString release];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我有与以下链接中出现的完全相同的问题
不幸的是,到目前为止我找不到任何解决方案
备注:
1)我正在使用iOS 5和故事板 - 如果有所作为 -
2)我已经尝试过[self.tabBarController.tabBar setSelectedItem:[self.tabBarController.tabBar.items objectAtIndex:3]];
,也没用
3)我试图为标签栏设置IBOutlet并直接访问它,但是当我调用[self.myTabbar setSelectedItem:[self.myTabbar.items objectAtIndex:3]];
并且出现此错误时应用程序崩溃了:不允许直接修改由标签栏控制器管理的标签栏