i trying add textfield coredata float value, when user press submit button. have error
thread 1:exc_bad_access(code=1,address=0x1)
my attributes inside .xcdatamodel file , nsmanagedobject class set type float.
@iboutlet weak var forceentered: uitextfield! @iboutlet weak var stiffnessentered: uitextfield! @ibaction func submit(sender: anyobject) { let appdel : appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let contxt : nsmanagedobjectcontext = appdel.managedobjectcontext! let en = nsentitydescription.entityforname("springvariables", inmanagedobjectcontext: contxt) var newitem = springmodel(entity:en!,insertintomanagedobjectcontext: contxt) newitem.stiffness = (stiffnessentered.text nsstring).floatvalue //error message shows here. newitem.force = (forceentered.text nsstring).floatvalue }
Comments
Post a Comment