I’m having an issue whereby a UIImageView occasionally hangs, and I have to close the iPad simulator and relaunch. The problem I’m seeing happens only sporadically, and the exact same code will work one time, and not the next. The path to get to the hang point is always the same, as it happens soon after I’ve started the application up. I’ve not deployed the app to an iPad yet, so I don’t know if it’s an issue once deployed, however it’s incredibly frustrating.
I load an image into the UIImageView from disk, and the image hasn’t been changed between starts etc, but it fails on the same line of code every time it hangs, which is:
_imageView.Image = image;
Where “image” is a loaded UIImage.
Difficult to understand why, does anyone have any ideas?
I’ve managed to work out what the issue was. It was a threading issue of my own design. I was using a tag for each of my activity monitor views, however I was using the same tag for every activity monitor. When I removed it, I was checking if the view existed before removing it, then removing it. The issue was being caused when another thread tried to remove the tagged view at the same time as another thread tried to do the same, and it caused it to hang.
I’ve resolved this issue by using instance level variables for my activity monitor views, which means I only ever remove the view I require to remove, removing tagging altogether. Obviously I could have also made every tag different instead, but I felt that the method I implemented was best for my solution. Thanks for all your feedback!
Davoc