xcode - Avoid "Can't make ...class... into type number." error -
property myvalue : "" property mypopup : missing value on applicationwillfinishlaunching_(anotification) tell standarduserdefaults() of current application's nsuserdefaults registerdefaults_({myvalue:myvalue}) set myvalue objectforkey_("myvalue") text end tell mypopup's selectitematindex_(myvalue - 1) end applicationwillfinishlaunching_ on mybuttonhandler_(sender) set myvalue (mypopup's indexofselecteditem) + 1 -- line may mistake end mybuttonhandler_ on applicationshouldterminate_(sender) tell standarduserdefaults() of current application's nsuserdefaults setobject_forkey_(myvalue, "myvalue") end tell return current application's nsterminatenow end applicationshouldterminate_
i wrote code, debug error:
(project name)[42733:303] *** -[appdelegate mybuttonhandler:]: can’t make «class ocid» id «data optr00000000c7ffffffffffffff» type number. (error -1700)
can tell me how code fixed? how avoid error?
i solved problem myself.
property myvalue : "" property mypopup : missing value on applicationwillfinishlaunching_(anotification) tell standarduserdefaults() of current application's nsuserdefaults registerdefaults_({myvalue:myvalue}) set myvalue objectforkey_("myvalue") text end tell mypopup's selectitematindex_(myvalue - 1) end applicationwillfinishlaunching_ on mybuttonhandler_(sender) set myvalue (mypopup's indexofselecteditem()) + 1 --here mistake end mybuttonhandler_ on applicationshouldterminate_(sender) tell standarduserdefaults() of current application's nsuserdefaults setobject_forkey_(myvalue, "myvalue") end tell return current application's nsterminatenow end applicationshouldterminate_
i should have written indexofselecteditem() wrote indexofselecteditem.
Comments
Post a Comment