I am creating a simple web viewer using WKWebView and the Swift language. Here is my code.
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
}
}
I'm now getting a "Thread 1:EXC_BAD_ACCESS" error on the webView = WKWebView()
line when I try to run the application. How can I fix this?