I'm working with the FMDB, The SQLite Wrapper for iOS.
General Problem:
I'm reading a long string (Base64 encoded image) from the db and then sending it to a UIWebView to be displayed. The when I pop the view controller storing that webview (with the image) the program quits unexpectadly with:
([Controller respondsToSelector:] sent to deallocated instance...btw, I am not calling that method)
The error only cropped up when I started using the large strings.. It never happened before that which leads me to believe it may be something to do with memory and the string not being released in Objective-c after it is sent to the webview.
Possible Solution
I would like to know how I can take control of the string returned from FMDB's "stringForColumn" method. The way I see it is that I can't ever call release on the resultant string as i'm not creating it.
I'm pr开发者_运维知识库etty sure I need to dump that string from memory straight after it is sent to the webview (via stringByEvaluatingJavaScriptFromString)
Any ideas greatly appreciated as this is a real show stopper for me :(
Thanks!
if you need for some reason to keep in memory that string, you should call
yourString = [[db stringForColumn:@"foo"]retain];
since then, you are responsible for that string, and you should release when you're done with it.
精彩评论