Crashlytics says about several crashes happened randomly.
Please consider the following code:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("NewsfeedItemCell", forIndexPath: indexPath) as NewsfeedItemTableViewCell
let newsfeedItem = self.newsfeedItems[indexPath.row]
// This line gives crash: EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000000
let text = newsfeedItem.text as NSString
cell.descriptionLabel.text = text
return cell
}
Here is NewsfeedItem
class:
class NewsfeedItem: NSManagedObject {
@NSManaged var date: NSDate
@NSManaged var sku: String
@NSManaged var text: String
var dataItem: DataItem?
}
PS: PLEASE NOTE that NewsfeedItem.text
property IS NOT Optional, so it can't be nil
!