PDA

View Full Version : UIWebView and NSURLRequest questions...




Xino
Nov 14, 2008, 08:32 AM
I have two questions about UIWebView and NSURLRequest.

I'm loading a HTML file within an UIWebView object which is loading alltime because i'm pushing data to it by using a hidden iframe (this is called pushing HTTP). The problem is, the cache is being updated all time and there for the application chrashes after several minutes because of a memory error. I'm using the method 'didReceiveMemoryWarning' for watching the memory. When the method 'didReceiveMemoryWarning' is being executed (it is sometimes because I see it in my console using NSLog), I execute another function and release the NSURLRequest and UIWebView to make free some memory so the application won't crash in the future. The problem is the application still crashes. Releasing the UIWebView and NSURLRequest is not helping and after some investigation on the internet I found out this is a 'bug' in UIWebView. For more information see this page: http://discussions.apple.com/thread.jspa?threadID=1729697&tstart=135.

My question, is there really no solution to release those objects and prevent crashing?

Another question, because I'm using a hidden iframe the request is loading alltime except when the connection has lost. I'm using a NSTimer which is triggering a function to check the status of the request using isLoading.
The problem is when I execute this function, it says it's loading but at the moment the parrent page finished loading and the iframe is still receiving data (it's always receiving data because of streaming http) it also says it's finished loading but it isn't. Why is this? When the parrent page is being executed, are there other NSURLRequest created for iframes, etc.? How can i fix this?



jnic
Nov 14, 2008, 09:12 AM
The 2.2 firmware is supposedly due out very soon (http://www.macrumors.com/2008/11/11/iphone-2-2-firmware-10-days-away/), so perhaps worth waiting to see if a fix appears for UIWebView's various memory bugs?