类没有初始值设定项(Xcode 6.3)

时间:2015-04-20 18:44:09

标签: xcode swift init

尝试在更新到Xcode 6.3后找出错误。我有一个课程得到错误'班级没有初始化者'谁能告诉我如何解决这个问题?

class TodayViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, BWWalkthroughViewControllerDelegate {


var events: [EKEvent] = []
let eventStore = EKEventStore()
var pttCalendar: EKCalendar?

let walkthroughVC : BWWalkthroughViewController?

@IBOutlet weak var tableView: UITableView!

var dateFormatter = NSDateFormatter()

override func viewDidLoad() {
    super.viewDidLoad()

    requestCalendarAccess()

    let firstLaunch = NSUserDefaults.standardUserDefaults().boolForKey("FirstLaunch")
    if firstLaunch  {
        println("Not first launch.")
    }
    else {
        showWalkthrough()
        println("First launch, setting NSUserDefault.")
        NSUserDefaults.standardUserDefaults().setBool(true, forKey: "FirstLaunch")
    }


    self.tableView.rowHeight = 50

    dateFormatter.dateFormat = "EE, MMM dd"
    let dateForLabel = dateFormatter.stringFromDate(NSDate())

    self.title = dateForLabel
}

2 个答案:

答案 0 :(得分:0)

您忘记了覆盖func init()

答案 1 :(得分:0)

您需要初始化设置值

let walkthroughVC : BWWalkthroughViewController?

将其设置为var将删除错误。它当然默认为nil