基本上我正在访问此网址
但是,结果是空的。即使它应该显示一些东西。我用了objective-c
使用此代码:
response= [NSURLConnection sendSynchronousRequest:request returningResponse:&urlresponse error:&error];
json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
我认为|需要进行urlencoded。怎么做?
答案 0 :(得分:0)
[NSURLConnection sendSynchronousRequest:request returningResponse:&urlresponse error:&error];
返回NSData,序列化时会产生JSON,所以你需要这样做:
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingAllowFragments error:&error];
获取JSON。