April 19, 2010

iPhone: You can't have a UIView subclass named "WebView"

Good lord, this wasted half a day. I was creating a UIView subclass to hold a UIWebView, and named it "WebView". Not too abstract, right? I kept getting the following cryptic error:
*** -[WebView _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x463a7b0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[WebView _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x463a7b0'
I renamed my class "WebViewView" and no more errors. Thanks for the shitty error messages Apple!

1 comment:

  1. saved my life, thanks! In my case the class name was RootView; and it works perfect in iPhone, crashes in Simulator.

    And also it wasn't crashing before (when it was a subclass of UITableViewController) (now it's subclass of UIViewController)

    ReplyDelete