Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EXC_BAD_ACCESS error when trying to change Bool property

I'm trying to change a Bool property and am receiving an EXC_BAD_ACCESS error.

I'm using XCode 6 and Swift.

The note property saves fine but the completed property throws the EXC_BAD_ACCESS error

enter image description here

import Foundation
import CoreData

class Task: NSManagedObject
{

    @NSManaged var note: String!
    @NSManaged var completed: Bool

}

Changing out the property routine

    // taskObject is an instance of Task()

    // Set the completed flag
    taskObject.completed = true // EXC_BAD_ACCESS
like image 498
vutran Avatar asked Jun 09 '14 00:06

vutran


Video Answer


1 Answers

You can use a swift Bool with an NSManagedObject - no need for the NSNumber nonsense. But you need to make sure that in the core data editor, the class is not empty. Enter your objects' name.

do not leave this empty

like image 67
Jason Moore Avatar answered Sep 27 '22 17:09

Jason Moore