1

This works in OS X:

WebPreferences *prefs = [webView preferences];
[prefs setDeveloperExtrasEnabled:YES];

WebInspector *inspector = [[WebInspector alloc] initWithWebView:webView];

But crashes in macOS:

-[WebInspector initWithWebView:]: unrecognized selector sent to instance 0xb1ab1ab1a

Is this Private API thrown out?

The code is taken from here.

Community
  • 1
  • 1
Dmitry Isaev
  • 3,888
  • 2
  • 37
  • 49

1 Answers1

2

They've renamed it: http://trac.webkit.org/changeset/189654

TLDR:

WebInspector *inspector = [WebInspector alloc];

if ([inspector respondsToSelector:@selector(initWithWebView:)])
    [inspector initWithWebView:webView];
else
    [inspector initWithInspectedWebView:webView];

In case of future changes, just look at the WebKit source code.

Dmitry Isaev
  • 3,888
  • 2
  • 37
  • 49