iOS实现从服务器请求json数据并转化成NSDictionary
NSURL *url = [NSURL URLWithString:URL];
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadRevaildatingCacheData timeoutInterval:10];
NSURLResponse *response;
NSError *error;
NSData *data = [NSURLConnection sendSynchronousRequest returningResponse:&response error:&errro];
NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
NSLog(@"%@\n %@",str,dic);