【发布时间】:2014-10-08 09:03:08
【问题描述】:
我正在使用 WKWebView 和 Swift 语言创建一个简单的 Web 查看器。这是我的代码。
import Cocoa
import WebKit
@NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet var containerView : NSView! = nil
@IBOutlet weak var window: NSWindow!
func applicationDidFinishLaunching(aNotification: NSNotification) {
// Insert code here to initialize your application
var webView: WKWebView
webView = WKWebView() //Thread 1:EXC_BAD_ACCESS (code=1,address=0x20)
var url = NSURL(string:"http://www.google.com/")
var req = NSURLRequest(URL: url!)
webView.loadRequest(req)
}
func applicationWillTerminate(aNotification: NSNotification) {
// Insert code here to tear down your application
}
}
当我尝试运行应用程序时,我现在在 webView = WKWebView() 行上收到“线程 1:EXC_BAD_ACCESS”错误。我该如何解决这个问题?
【问题讨论】:
标签: ios swift exc-bad-access wkwebview