如何解决加载图像的问题 Xcode Swift 5使用 SDWebImage/Backblaze
我遇到了一个奇怪的问题。 短版
问题: 在我们这边没有问题。我们的用户在显示图像时都不会遇到问题。 但是,当 Apple 审核我们的应用时,他们根本无法下载图片(这对我们和所有用户都适用)。
我们测试了什么
- SDWebImage 很快被 Kingfisher 取代 -> 结果相同
- 我们尝试重现该问题,但无法重现:我们将模拟器的位置设置为所有可能的位置 + 更改语言、干净重建等。从未遇到过该问题。
- 我们尝试使用 AllowArbitrary 加载,但仍然不适用于我们的 Apple 审核人员。
postimageView.sd_imageIndicator?.startAnimatingIndicator()
let photoUrl = URL(string: photoUrlString)
postimageView.backgroundColor = .systemGray3
postimageView.sd_imageIndicator = SDWebImageActivityIndicator.grayLarge
SDWebImageDownloader.shared.config.downloadTimeout = 40
postimageView.sd_setimage(with: photoUrl,placeholderImage: nil,options: .allowInvalidSSLCertificates) { (image,err,sd,url) in
self.postimageView.sd_imageIndicator = nil
self.postimageView.sd_imageIndicator?.stopAnimatingIndicator()
if err != nil {
self.postimageView.image = UIImage(named: "placeholder-image")
Ref().databaseProblems.child("IMAGE_IOS").child(UUID().uuidString).setValue("\(err.debugDescription) + \(err?.localizedDescription ?? "")")
}
}
Optional(Error Domain=NSURLErrorDomain Code=-1001 \"The request timed out.\" UserInfo={_kcfStreamErrorCodeKey=60,NSUnderlyingError=0x28334f120 {Error Domain=kcfErrorDomainCFNetwork Code=-1001 \"(null)\" UserInfo={_kcfStreamErrorCodeKey=60,_kcfStreamErrorDomainKey=1}},_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <49574986-C917-4980-ABC7-6A9E9EBD6892>.<3>,_NSURLErrorRelatedURLSessionTaskErrorKey=(\n \"LocalDataTask <49574986-C917-4980-ABC7-6A9E9EBD6892>.<3>\"\n),NSLocalizedDescription=The request timed out.,NSErrorFailingURLStringKey=https://f000.backblazeb2.com/file/Images/-MVVvWz3rlPQw5J5_Ah_,NSErrorFailingURLKey=https://f000.backblazeb2.com/file/Images/-MVVvWz3rlPQw5J5_Ah_,_kcfStreamErrorDomainKey=1}) + The request timed out."
"Optional(Error Domain=SDWebImageErrorDomain Code=2002 \"Operation cancelled by user during sending the request\" UserInfo={NSLocalizedDescription=Operation cancelled by user during sending the request}) + Operation cancelled by user during sending the request"
"Optional(Error Domain=NSURLErrorDomain Code=-1022 \"The resource Could not be loaded because the App Transport Security policy requires the use of a secure connection.\" UserInfo={NSLocalizedDescription=The resource Could not be loaded because the App Transport Security policy requires the use of a secure connection.,NSErrorFailingURLStringKey=http://f000.backblazeb2.com/file/Images/-MVTKiJrFDOldW94d0cO,NSErrorFailingURLKey=http://f000.backblazeb2.com/file/Images/-MVTKiJrFDOldW94d0cO,_NSURLErrorRelatedURLSessionTaskErrorKey=(\n \"LocalDataTask <F3ADD147-226D-48EF-8B3A-2C61EF2887FE>.<2>\"\n),_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F3ADD147-226D-48EF-8B3A-2C61EF2887FE>.<2>,NSUnderlyingError=0x60400036d550 {Error Domain=kcfErrorDomainCFNetwork Code=-1022 \"(null)\"}}) + The resource Could not be loaded because the App Transport Security policy requires the use of a secure connection."
信息.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>https://f000.backblazeb2.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
有什么想法/建议吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。