iOS9之后有关加载明文网络地址的问题

1.UIImageView加载网络路径时,由于直接明文路径,现在不能直接显示出来。

NSURL*url = [NSURLURLWithString:@"http://pica.nipic.com/2007-11-09/200711912453162_2.jpg"];
NSData*data = [NSDatadataWithContentsOfURL:url];
UIImage*image = [UIImageimageWithData:data];

提出错误:
*Xcode提示:App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.*

2.UIWebView 加载网址的时候出现如下错误:
'NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)'

解决办法:
在Info.plist文件中添加"App Transport SecuritySettings", Type为"Dictionary",再添加"Allow Arbitray Loads", Type 为"Boolean",“Value”为“YES”即可。

如图所示

你可能感兴趣的:(iOS9之后有关加载明文网络地址的问题)