我们正在iOS 8 SDK上使用Xcode 6 beta 5 + Swift创建一个应用程序.我们也想部署到iOS 7.那可能吗?当我们将项目的部署目标设置为7.0时,我们得到如下编译时错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_WKPreferences", referenced from:
__TMaCSo13WKPreferences in WebViewController.o
"_OBJC_CLASS_$_WKWebView", referenced from:
__TMaCSo9WKWebView in WebViewController.o
"_OBJC_CLASS_$_WKWebViewConfiguration", referenced from:
__TMaCSo22WKWebViewConfiguration in WebViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
我相信这是因为我们正在使用WKWebKit,仅由iOS 8+支持.我们可以使用UIWebKitiOS 7但WKWebKit适用于iOS 8.我们如何定义它?
我们的类定义看起来像这样......
import WebKit
class WebViewController: UIViewController, WKNavigationDelegate {
...
}
Run Code Online (Sandbox Code Playgroud)
它被称为:
let mainStoryboard = UIStoryboard(name: "Main", bundle: …Run Code Online (Sandbox Code Playgroud)