我遇到了一个奇怪的问题。精简版
- 我们现在在应用商店中有一个带有照片提要的应用已经好几个月了。我们有很多用户(99.9% 在欧洲,主要是中欧)。
- 使用 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."
信息列表
<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>
有什么想法/建议吗?