//将网络数据加载到本地
NSString *[email protected]"http://10.0.8.8/sns/my/user_list.php?page=1&number=5";
NSURL *url=[NSURL URLWithString:strUrl];
NSData *data=[[NSData alloc]initWithContentsOfURL:url];
//通过NSData数据,封装NSString字符串中
NSString *strContent=[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
//通过json解析数据
NSDictionary *dict=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
NSLog(@"%@",dict);
时间: 2024-11-10 00:17:30