如何从 NSDictionary 到 NSArray 获取数据
展开全部
只贴代码,运行输出
NSURL *url = [NSURL URLWithString:@"l"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0f];
NSError *error = [[NSError alloc] init];
NSURLResponse *response = [[NSURLResponse alloc] init];
NSData *responeData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response
error:&error];
NSDictionary *jsonToDictionary = [NSJSONSerialization JSONObjectWithData:responeData
options:0
error:&error];
NSDictionary *dictionaryData = [jsonToDictionary objectForKey:@"weatherinfo"]; NSLog(@"%@",dictionaryData);
NSURL *url = [NSURL URLWithString:@"l"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0f];
NSError *error = [[NSError alloc] init];
NSURLResponse *response = [[NSURLResponse alloc] init];
NSData *responeData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response
error:&error];
NSDictionary *jsonToDictionary = [NSJSONSerialization JSONObjectWithData:responeData
options:0
error:&error];
NSDictionary *dictionaryData = [jsonToDictionary objectForKey:@"weatherinfo"]; NSLog(@"%@",dictionaryData);
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询