IBAction UIButton and EXC_BAD_ACCESS

↘锁芯ラ 提交于 2019-12-11 17:44:40

问题


in .h file I write

-(IBAction)openShuffleForm;

and .m

-(IBAction)openShuffleForm{
   NSLog(@"XXXXXXX");
}

and connect with even touch up inside but when I run my program it error show this message

-[UITouchData openShuffleForm]: unrecognized selector sent to instance 0x391cc20

** What happen I don't know why?


回答1:


Did you create the link between the button and the implementation? The implementing class should have an IBOutlet of type UIButton. Bind the IBOutlet to the button in Interface builder. This will cause the button to automatically be instantiated when the view is rendered and the BAD ACCESS should be alleviated.




回答2:


In my case it was a modal window which I released after opening. Thus any button which I clicked to try to call ANY IBAction would not work from that Modal View and kill the app with SIGBART or BAD_EXEC errors.



来源:https://stackoverflow.com/questions/2801103/ibaction-uibutton-and-exc-bad-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!