Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WKWebView not in Xcode

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.

like image 338
kaneyip Avatar asked Sep 23 '15 07:09

kaneyip


People also ask

How do I install WKWebView?

Loading local content WKWebView can load any HTML stored in your app bundle using its loadFileURL() method. You should provide this with a URL to some HTML file that you know is in your bundle, along with another URL that stores any other files you want to allow the web view to read. That url.

Is WKWebView deprecated?

Apple is phasing out UIWebView, which is used by developers for integrating web content into an app in a quick and secure manner. Apple is replacing UIWebView (and WebView) with WKWebView, an updated version, as UIWebView has been deprecated.

How do I add WKWebView to my storyboard?

First add the web view as a UIWebView outlet in the storyboard / IB. This will give you a property like this: @property (weak, nonatomic) IBOutlet UIWebView *webView; Then just edit your code to change it to a WKWebView.

Is WKWebView the same as Safari?

WKWebView - This view allows developers to embed web content in your app. You can think of WKWebView as a stripped-down version of Safari. It is responsible to load a URL request and display the web content. WKWebView has the benefit of the Nitro JavaScript engine and offers more features.


2 Answers

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() 
like image 50
Johnykutty Avatar answered Sep 24 '22 13:09

Johnykutty


you need to import webkit in file

import WebKit 
like image 21
saigopi.me Avatar answered Sep 25 '22 13:09

saigopi.me