我會盡量做到儘可能的簡單我是從核心數據使用NSFetchedResultsController我的cellForRowAtIndexPath看起來像這樣核心數據+ NSFetchedResultsController在SWIFT
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell? {
var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
let newEntry : Entry = fetchedResultController.objectAtIndexPath(indexPath) as Entry
cell.textLabel.text = newEntry.title
return cell
}
我的應用程序崩潰,
當我更換取下面
let newEntry : Entry = fetchedResultsController.objectAtIndexPath(indexPath) as Entry
符合該行的應用程序的工作記錄填充tableview中沒有錯誤沒有問題
let newEntry : AnyObject! = self.fetchedResultsController.objectAtIndexPath(indexPath)
的問題是,爲什麼不AnyObject是一款入門NSManagedObject
謝謝
建議:兩個問題應該寫爲SO兩個獨立的問題。 – andrewbuilder