core data - Swift Gives error Thread 1: EXC_BAD_ACCESS(code=1, address=0x0) when accessing NSManagedObject's property -


Text after "

NSManagedObject is my task to create subclass objects;

  function loginMoldelWithName (name: NSString, AtIndexPath index: NSIndexPath) - & gt; LoginModel {the unit = NSEntityDescription.entityForName ( "LoginModel", inManagedObjectContext: managedObjectContext) var login = LoginModel (unit: unit!, InsertIntoManagedObjectContext: managedObjectContext) login.name = Name login.date = NSDate () login.rowIndex = indexPath. NSNumber var error as the line: NSError? ! ManagedObjectContext .save (& amp; error) if {println ( "\ (TAG) could not be saved \ (error) \ (error .userInfo)?")} As LoginModel  
< Return login p>}

and delete one;

  function deleteLoginModel (loginModel: LoginModel) {println ( "\ (TAG) \ (loginModel.name)") managedObjectContext .deleteObject (loginModel) var error: NSError? If (managedObjectContext .save (& amp;! Error)) {println ("? \ (TAG) \ (error .localizedDescription)")}}  

And wherever the problem is, Login Modlod = loginModel println ( "\ (TAG) \ (loginModel.name)") as the English model = login module [indexPath.row] Give) // core data deletion log Remove model (English model) ...

removing loginModel object when I try to access loginModel.name, I get this error after "Thread 1: EXC_BAD_ACCESS (code = 1, address = 0x0)"

Invalid expression, log in variable view Did not went written for the model, see Snafsot down ...

may not know that was where I went wrong and what the English model frequency me?

< Div class = "post-document" itemprop = "text">

From a screenshot connected to you, it seems that an error occurs because you are trying to use the property of an object after that At that point on the object that has been removed, the properties of the object will no longer have a valid memory address.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -