2017-06-28 19 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