IBAction UIButton and EXC_BAD_ACCESS

2019-09-04 23:25发布

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?

2条回答
走好不送
2楼-- · 2019-09-05 00:03

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.

查看更多
Lonely孤独者°
3楼-- · 2019-09-05 00:04

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.

查看更多
登录 后发表回答