EXC_BAD_ACCESS in UIWebView

It's almost 100% an error in your code. Errors in the iPhone SDK are quite rare and UIWebView has been tested quite good by many other developers.

EXC_BAD_ACCESS occurs usually when you try to access an already released object. Obviously if Apple's code is trying to do that you are the one who has released the object wrongly. Are you sure you don't have a -autorelease or -release too much?


The scenario goes something like this:

  1. User enters screen with UIWebView. The UIViewController sets self as the delegate
  2. Web page starts downloading
  3. User exits screen
    3a. UIViewController gets deallocated
  4. UIWebView finishes loading and sends "I finished" message to its delegate...

You need to stop the UIWebView from loading its page and sets its delegate to nil before you deallocate the delegate.