WKWebView 不在 Xcode 中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32733431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:12:18  来源:igfitidea点击:

WKWebView not in Xcode

xcodewkwebview

提问by kaneyip

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.

我需要使用 Xcode 为我的 ios 应用程序实现 WKWebview。但是我在使用它时出错“未声明的类型'WKWebview'”。我错过了什么重要的东西吗?

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

我正在使用从 App Store 下载的最新 Xcode7。

回答by Johnykutty

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

如果您使用的是 swift,请首先在您使用 Web Kit API 的任何文件中导入 WebKit 模块:

import WebKit

Then you can use the web view:

然后你可以使用 web 视图:

let webView = WKWebView()

回答by Sai Gopi N

you need to import webkit in file

您需要在文件中导入 webkit

import WebKit

回答by KudoCC

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

你应该导入标题 #import <WebKit/WebKit.h>

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

WebKit.framework如果您使用的是objective-c ,请添加构建阶段。

回答by Sergio

still dealing with Objective-C?

还在处理Objective-C?

#import <WebKit/WebKit.h>