Recreating UIWebView causes crashes (2.2)

Discussion in 'iPhone/iPad Programming' started by Xino, Nov 27, 2008.

  1. macrumors member

    Joined:
    Sep 5, 2008
    #1
    I've created an UIWebView object which is loading HTML constantly (streaming HTTP using chunking so the application supports pushing). The following code is responsible for creating the UIWebView object:

    Code:
    webViewMonitor = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 431.0f, 320.0f)];
    	[webViewMonitor setBackgroundColor:[UIColor whiteColor]];
    	[viewMonitor addSubview:webViewMonitor];
    
    The problem is the application is taking more and more memory every second. I've implemented the method 'didReceiveMemoryWarning' for checking the memory. When the method 'didReceiveMemoryWarning' is being executed, I'm releasing the UIWebView using [viewMonitor release]. The application is not crashing because of this. Now when I'm trying to recreate the webViewMonitor, the application crashes...

    What am I doing wrong? Do I need to release and recreate the NSURL and NSURLRequest too?
     

Share This Page