今天我已经将我的项目从 XCode 6 转移到 XCode 7。之前它运行完美,但现在我遇到了一些奇怪的问题。
我在 UIImageView 上显示图像,该图像是从网络上下载的。这是代码:
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
NSData *data = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [UIImage imageWithData:data];
dispatch_async(dispatch_get_main_queue(), ^{
[cell.imgTrainer setImage:image];
selectedTrainerImage = image;
});
});
我已经检查过imageURL
,没问题。
我正在用 presentViewController
调用页面
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController* controller = [storyboard instantiateViewControllerWithIdentifier:@"TrainerListView"];
self.animationController = [[ZoomAnimationController alloc] init];
controller.transitioningDelegate = self;
[self presentViewController:controller animated:YES completion:nil];
我不明白这是什么问题。我什至没有触及在 XCode 6 上运行的任何一行。
最佳答案
对于临时,您可以将 key 添加到 plist。但它不安全。
http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/
<key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
关于ios - XCode 7 上不显示 UIImageView 网络图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32822691/