2017-06-28 31 views
0

任何人都可以帮助我找出运行我的应用程序时遇到的以下错误吗?“连接中断”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)沟通错误:请尽早帮助我。

+0

可以尝试加载本地图片? ...仅供测试 – cristallo

回答

0

从这一行customCell.imgView.sd_setImage(with: URL(string: imageURL!),崩溃很可能是因为您试图使用SDWebImage加载非常大的图像或大量的图像。我的建议是预先在后台下载所有图像,将它们保存到文档文件夹中,然后将它们加载到您的文件夹UITableView

0

可能您正在重载SDWebImage下载程序。

你可以试着捏捏图像下载更改并发下载的最大数量或下载超时

斯威夫特3

(SDWebImage V 4.0.0)

SDWebImageManager.shared().imageDownloader?.maxConcurrentDownloads = yourValue 

SDWebImageManager.shared().imageDownloader?.downloadTimeout = yourTimeout 
+0

它在iOS 10或更高版本中没有任何问题。问题仅在iOS版本低于10时出现。 –

+0

XPC是Apple的进程间通信(IPC)系统。一些功能(可能与图像下载相关)由独立的守护进程处理 - 在后台运行。 连接中断意味着IPC连接由于某种原因而中断。也许这花了太长时间,也许时机很糟糕,守护进程或者你的应用需要紧急做别的事情。 该系统由操作系统提供。所以我并不感到惊讶,它只发生在一个特定的版本上。 – cristallo

+0

你可以验证应用程序使用的内存量吗?如果你的系统内存不足,它可能会产生这种问题。 – cristallo