81

I need to implement the WKWebview for my ios app with Xcode. However i have error when using it "undeclared type 'WKWebview'". Do i missing anything important.

I'm using the latest Xcode7 download from App Store.

Abizern
  • 146,289
  • 39
  • 203
  • 257
kaneyip
  • 1,237
  • 1
  • 17
  • 21

5 Answers5

131

If you are using swift, first import the WebKit module in any files you're using web kit API:

import WebKit

Then you can use the web view:

let webView = WKWebView()
Jack Lawrence
  • 10,664
  • 1
  • 47
  • 61
Johnykutty
  • 12,091
  • 13
  • 59
  • 100
67

you need to import webkit in file

import WebKit
saigopi.me
  • 14,011
  • 2
  • 83
  • 54
32

You should import the header #import <WebKit/WebKit.h>

and add WebKit.framework in Build Phases if you're using objective-c.

KudoCC
  • 6,912
  • 1
  • 24
  • 53
19

Swift 5:

import WebKit

And add WebKit.framework in Frameworks section under General project settings

Jay Mehta
  • 1,511
  • 15
  • 20
13

still dealing with Objective-C?

#import <WebKit/WebKit.h>
Sergio
  • 2,346
  • 2
  • 24
  • 28