self.dataTask =[self.urlSession dataTaskWithRequest:self.urlRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error)
{
self.dataDict =[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
//NSLog(@"data in dict is %@",[[[[self.dataDict objectForKey:@"feed"]objectForKey:@"results"]objectAtIndex:1]objectForKey:@"name"]);
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
TableViewController *tvc=[self.storyboard instantiateViewControllerWithIdentifier:@"tableVC"];
tvc.reciverDict=self.dataDict;
[self presentViewController:tvc animated:YES completion:^{
}];
});
}];
[self.dataTask resume];
}
当我实例化tableviewcontroller得到异常时,这就是为什么我从主队列调用它仍然导致异常的原因。