我的iOS应用程序中有这个代码,用Swift编写:
class AddHomeViewController: UITableViewController, UITextFieldDelegate
{
...
required override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?)
{
super.init(nibName: nibName, bundle: nibBundle)
}
更新到Xcode 6.1后,我在super.init(nibName: nibName, bundle: nibBundle)
行上收到了这些错误。它之前运作得很好:
Use of property 'nibName' in base object before super.init initializes it
Use of property 'nibBundle' in base object before super.init initializes it
答案 0 :(得分:6)
更改super.init()
行以使用OrNil
参数可解决问题:
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)