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
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.
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.
Just chipping in for anyone else who is struggling on this one.
For me the solution was to restart my device.
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.
I had this same issue when loading a bunch of very large images (5000px x 5000px) in UIImage
s. Luckily the images were not supposed to be anywhere near that big and I just needed to resize them.
This bug appears frequently since I switched on iOS 11 Beta. Sometimes restarting the device works, sometimes my computer...