XCode 6.3 Init()不再编译

Khi*_*rok 1 xcode ios swift

刚刚升级到XCode 6.3并且已经解决了所有的编译错误,除了在我的众多类别中出现的错误.

我在示例类中执行以下操作:

init()
{
    super.init()

    let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
    managedContext = appDelegate.managedObjectContext!
}
Run Code Online (Sandbox Code Playgroud)

这会在super.init()调用上返回以下错误:

Must call a designated initializer of the superclass 'UITableViewController'
Run Code Online (Sandbox Code Playgroud)

有人看过这个或者想出一个解决方案吗?

Sul*_*han 6

您必须使用指定的初始化程序UITableViewController,即

init(style style: UITableViewStyle)
Run Code Online (Sandbox Code Playgroud)

例如:

super.init(style: .Plain)
Run Code Online (Sandbox Code Playgroud)