[英]JSON and iOS and string data
I have a problem with my attempt to show data in JSON UITableViewDataSource The data from JSON are: 我尝试在JSON UITableViewDataSource中显示数据时遇到问题,来自JSON的数据为:
[
"Jon",
"Bill",
"Kristan"
]
JSON itself has gone through the validator. JSON本身已通过验证程序。 The error I have is TableViews [2050: f803] Illegal start of token [h] 我遇到的错误是TableViews [2050:f803]令牌[h]的非法开头
Here is my code 这是我的代码
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.
You don't fetch the JSON data from the URL. 您无需从URL提取JSON数据。 Instead you try to parse the URL itself. 相反,您尝试解析URL本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.