当我调用这个块时:
NSURLSession *session = [NSURLSession sharedSession];
[[session dataTaskWithURL:url
completionHandler:^(NSData *data,
NSURLResponse *response,
NSError *error) {
_data = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
_label.text = [NSString stringWithFormat:@"%@°",([[[self.data objectForKey:@"main"] objectForKey:@"temp"] floatValue]) - 273.15)];
NSLog(@"%@",self.data);
}] resume];
即使调用了 NSLog,块内的代码也需要很长时间才能执行——这是怎么回事?我尝试了各种解决方案,但没有任何效果。