Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS-从UIImageView中的解析检索并显示图像(Swift 2.1错误)_Ios_Uiimageview_Swift2.1 - Fatal编程技术网

iOS-从UIImageView中的解析检索并显示图像(Swift 2.1错误)

iOS-从UIImageView中的解析检索并显示图像(Swift 2.1错误),ios,uiimageview,swift2.1,Ios,Uiimageview,Swift2.1,我正在尝试从解析中获取一个与此问题类似的图像 它不断返回零我认为您的错误是由于应用程序传输安全造成的。您正在从不安全的http url获取图像,为此,必须在Info.plist文件中启用该url 基本上,您可以测试的是通过添加 <key>NSAppTransportSecurity</key> <dict> <!--Include to allow all connections (DANGER)--> <key>NSAll

我正在尝试从解析中获取一个与此问题类似的图像


它不断返回零

我认为您的错误是由于应用程序传输安全造成的。您正在从不安全的http url获取图像,为此,必须在Info.plist文件中启用该url

基本上,您可以测试的是通过添加

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>
NSAppTransportSecurity
NSAllowsArbitraryLoads
到您的Info.plist文件。(右键单击Info.plist->openas->source code,然后添加上面的键和值。)

如果这样做有效,您应该只为此url添加一个特殊权限,并恢复以前的禁用状态

只启用特定域有点棘手。你需要知道一点什么违反了ATS来修复它。我想会是这样的

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>parse.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>
NSAppTransportSecurity
NSExceptionDomains
parse.com
n包括多个域
NSTemporary ExceptionalLowsInSecureHttpLoads
NSTemporaryExceptionMinimumTLSVersion
TLSv1.1

您显示的代码中没有返回值。。。你的意思是UIImage构造函数返回nil吗?@Animal它返回nil的imageData成功了!非常感谢。请更新您关于添加www.parse.com特殊权限的回答,好吗?
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>parse.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>