0

I have stopped all simulator processes but still getting below error.

Restore the connection to "iPad 2" and run "APPNAME" again, or if "APPNAME" is still running, you can attach to it by selecting Debug > Attach to Process > APPNAME.

Getting this error in Xcode 7.3.1, which is not consistent.

enter image description here

I have a CollectionView and into that, I want to show images from the document directory. So I am using SDWebImage SDK for that. So somehow this happens due to this line.

let url:NSURL = NSURL(fileURLWithPath: myPathOfDocumentDirectory)
cell.myImageView.sd_setImageWithURL(url, placeholderImage: UIImage(named: "background"))

Because when I put comment on line for set the image into ImageView via SDWebImage SDK, then app not getting crashed. Otherwise it will crash randomly. Also it happens in devices too. I have test this in many devices.

I have read many answers, but into all that answers, talking about reset the simulator. But this happens many times with me. So I want a solution for this.

So Is there anyway to show images from document directory in CollectionView..?

Any help would be appreciated.

Meet Doshi
  • 4,241
  • 10
  • 40
  • 81
  • 1
    Base on my experience this issue is `memory issue`. Review this answer also :-> http://stackoverflow.com/questions/26020832/ios-app-crashes-xcode-says-lost-connection-to-xs-iphone-when-debugging – Mitul Marsoniya Jul 12 '16 at 10:05
  • @mitulmarsonia : Yess that's the issue. So I have compress my images and showing them to collection view. And no crashes. Thanks for the answer. – Meet Doshi Jul 12 '16 at 11:31

1 Answers1

0

Yess I got the solution. Thanks @mitulmarsonia for quick commenting on my question.

When loading a bunch of very large images (greater then 2000 or 3000 px) in UIImages, Luckily the images were not supposed to be anywhere near that big and I just needed to resize them.

Please resize of your images before saving them document directory if you want to show them into listings.

Please refer this question for more details.

Community
  • 1
  • 1
Meet Doshi
  • 4,241
  • 10
  • 40
  • 81