I've been getting th开发者_Python百科is random crash, in which I don't know how to reproduce again. It happens when I was browsing/using the apps for some time, switching views here and there and I got this:
First of all I don't know which UIImage is this crash referring to. I do have a crash report, but I don't know how to read it. I would like to reproduce the error, but I don't know how to.. it seems that it's quite random. Can someone help me out in debugging this?
Hard to say something for sure. This is my guess.
I see you are getting some data from an external source "convore.com". When you say you get the error randomly, I think it may be due to the data received from the convore.com api. Probably from time to time you are not getting the image, link, or graphics from the server and you don't create and image, and then you are trying to retain it, causing the error.
Without being able to reproduce the failure, it will be very hard.
If you cannot reproduce it, I would suggest building your project by using the Xcode option "Build and Analyze". Indeed, since this is seemingly a problem with retain/release, "Build and Analyze" could give you some hint at where things go bad. By the way, if you are not doing it, it is highly suggested, almost mandatory check.
You could try and post the crash report, but I doubt it will be useful. The point is finding out where the UIImage is deallocated and why, the crash report refers to an attempt to use the UIImage after its release, so this would likely be in a different portion of your code.
If you have some suspect as to which class contain this UIImage, you can post some code so that we can help you inspect it.
As a hopefully useful hint as to how to reproduce this issue, I would also suggest sending the simulator a Memory Warning. Indeed, in such cases all UIViews that are not displayed are released and this could be the culprit with your UIImage. So, you send it and see if the crash happens again... just a hint, anyway...
精彩评论