0

I am trying to utilize UIWebView functionality, specifically I want to do something like this: Open links in Safari instead of UIWebVIew?

But I am having an issue when I try and add the UIWebViewDelegate to my AppDelegate interface.

enter image description here

Anyone know what the issue is? Note this is Mac OS not iOS.

Community
  • 1
  • 1
joe
  • 16,988
  • 36
  • 94
  • 131

3 Answers3

7

Add:

#import <UIKit/UIKit.h>
Luda
  • 7,282
  • 12
  • 79
  • 139
3

Anyone know what the issue is? Note this is Mac OS not iOS.

That's the issue right there.

There is no UIWebView or UIWebViewDelegate on MacOS X. UI is the prefix for UIKit, which is the iOS equivalent of AppKit. When you see a class whose name begins with UI, you know immediately that you're looking at iOS code.

The class you're probably looking for is WebView. WebView actually uses five separate delegates, so you may need to implement as many as five different protocols: WebUIDelegate, WebDownload, WebFrameLoadDelegate, WebPolicyDelegate, and WebResourceLoadDelegate. (In reality, I don't think you need to do quite that much work. For example, you may not need to implement your own access policy.)

Caleb
  • 124,013
  • 19
  • 183
  • 272
0

UIWebView is iOS only. You cannot use a UIWebViewDelegate for Mac OSX. If you look at your own code, you are using a WebView, not a UIWebView.

You'll want to look at the WebView class docs

CrimsonDiego
  • 3,616
  • 1
  • 23
  • 26