iOS app crashes, xcode says 'Lost connection to X's iPhone' when debugging

后端 未结 8 2057
有刺的猬
有刺的猬 2020-12-05 12:36

My app crashes and I need some advice to find and fix the problem. It is not a device or cable problem because it happens with all devices and not only when debugging. Xcode

相关标签:
8条回答
  • 2020-12-05 12:57

    Yes, it is a memory issue, or you have opened too many threads. I have met this problem before. The problem I met like this:

    When I delete a photo, which may cost about 0.2s, I would like to show a toast(MBProgressHUD) to user, and GCD to hide the toast after deleting.
    When I tried to delete 100 photos, it is okay. However, when I tried to delete 200 photos, the app might be crashed. When I tried to delete 300 photos, the iPhone always restart itself.

    0 讨论(0)
  • 2020-12-05 13:03

    Just to add that I had the same issue running my app both on and old Ipad 3 and Iphone 6. What ended up being the problem was I had accidentally saved 2 images of the project as a 40mb and a 20mb version. So it was a memory issue. I downsized them as 1mb each, and issue solved.

    0 讨论(0)
  • 2020-12-05 13:06

    Just chipping in for anyone else who is struggling on this one.

    For me the solution was to restart my device.

    0 讨论(0)
  • 2020-12-05 13:06

    In my case, I use UICollectionView to show a bunch of photos and when I want to perform reloadData to the view, crash occurs, while the memory usage is not that high (less than 100M). Besides memory issue, I think reloadData of UICollectionView or UITableView may cause this, too.

    0 讨论(0)
  • 2020-12-05 13:07

    I had this same issue when loading a bunch of very large images (5000px x 5000px) in UIImages. Luckily the images were not supposed to be anywhere near that big and I just needed to resize them.

    0 讨论(0)
  • 2020-12-05 13:11

    This bug appears frequently since I switched on iOS 11 Beta. Sometimes restarting the device works, sometimes my computer...

    0 讨论(0)
提交回复
热议问题