【问题标题】:How to display images from S3 bucket using Xcode 7?如何使用 Xcode 7 显示来自 S3 存储桶的图像?
【发布时间】:2016-02-21 10:54:43
【问题描述】:

我正在使用 Amazon S3 存储桶来保存图像,它在 Xcode 6 中运行良好,但在升级到 Xcode 7 后,应用程序不显示图像。但是当我启用NSAppTransportSecurity 安全时,它工作正常。

在没有应用传输安全性的情况下如何让它工作?

【问题讨论】:

标签: ios xcode amazon-s3 xcode7


【解决方案1】:

您需要为托管图像的服务器添加一个例外,或者允许对应用的 plist 文件进行所有任意加载。 NSAppTransportSecurity 对于 iOS 9 及更高版本是必需的。

例外:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>download.yourServer.com.s3.amazonaws.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>

允许所有连接:

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

【讨论】:

    猜你喜欢
    • 2022-11-10
    • 1970-01-01
    • 1970-01-01
    • 2019-11-04
    • 2019-08-14
    • 1970-01-01
    • 2019-12-01
    • 1970-01-01
    • 2020-03-20
    相关资源
    最近更新 更多