“连接中断”iOS 9上的通信错误
问题描述:
任何人都可以帮助我找出运行我的应用程序时遇到的以下错误吗?“连接中断”iOS 9上的通信错误
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let customCell = tableView.dequeueReusableCell(withIdentifier: "tableViewCell", for: indexPath) as! CustomTableViewCell
customCell.selectionStyle = .none
let dictionaryAtIndex = contentArray[indexPath.row] as Dictionary <String, Any>
customCell.activityIndicator .isHidden = false
customCell.activityIndicator .startAnimating()
customCell.imgView.sd_setImage(with: URL(string: imageURL!), completed: { (image, error, cacheType, url) in
customCell.activityIndicator .stopAnimating()
customCell.activityIndicator .isHidden = true
print("image downloaded %@",image ?? "")
})
return customCell
}
它崩溃每次当我scrolling.Getting通信错误:{数= 1,内容= “XPCErrorDescription”=> {长度= 22,内容= “连接中断”}}>的Xcode 7(的iOS 9)沟通错误:请尽早帮助我。
答
从这一行customCell.imgView.sd_setImage(with: URL(string: imageURL!)
,崩溃很可能是因为您试图使用SDWebImage
加载非常大的图像或大量的图像。我的建议是预先在后台下载所有图像,将它们保存到文档文件夹中,然后将它们加载到您的文件夹UITableView
。
答
可能您正在重载SDWebImage下载程序。
你可以试着捏捏图像下载更改并发下载的最大数量或下载超时
斯威夫特3(SDWebImage V 4.0.0)
SDWebImageManager.shared().imageDownloader?.maxConcurrentDownloads = yourValue
SDWebImageManager.shared().imageDownloader?.downloadTimeout = yourTimeout
可以尝试加载本地图片? ...仅供测试 – cristallo