JSON和iOS和字符串数据
问题描述:
我有一个问题,我尝试在JSON UITableViewDataSource 显示的数据来自JSON的数据是:JSON和iOS和字符串数据
[
"Jon",
"Bill",
"Kristan"
]
JSON本身已经通过验证了。 我的错误是TableViews [2050年F803]的令牌[H]非法的开始
这里是我的代码
NSString *myRawJson = [NSString stringWithFormat:@"http://site.com/json.php"];
if ([myRawJson length] == 0){
return;
}
NSError *error = nil;
SBJsonParser *parser = [[SBJsonParser alloc] init];
tableData =[[parser objectWithString:myRawJson error:&error] copy];
NSLog(@"%@", [error localizedDescription]);
list = [[NSArray alloc] initWithObjects:@"Johan", @"Polo", @"Randi", @"Tomy", nil];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
答
你不从URL获取JSON数据。而是尝试解析URL本身。
可以举个例子吗?我担心你不明白。 – Slavi 2012-04-21 12:54:03