开发者

makeKeyAndOrderFront: again causes EXC_BAD_ACCESS

开发者 https://www.devze.com 2023-01-10 10:59 出处:网络
Im sure this is开发者_StackOverflow中文版 something really simple I\'m missing. I use makeKeyAndOrderFront: to open a window and it works the first time. When I close the window and try and open it ag

Im sure this is开发者_StackOverflow中文版 something really simple I'm missing. I use makeKeyAndOrderFront: to open a window and it works the first time. When I close the window and try and open it again it quits and gives me the error EXC_BAD_ACCESS. My code is this:

- (IBAction)viewScreen:(id)sender {

[screenView makeKeyAndOrderFront:sender];
}

I can't figure out why this is happening and the debugger console isn't saying much of anything.

Thanks in advance


Why are you calling your window variable screenView? That sounds like it should refer to a view, not a window.

Check whether your window has the “Release when closed” property turned on in IB. When that property is on, the window will release itself when anything or anybody closes it. This can be handy, but if you intend to show the same window again later on, it's probably not what you want.

More generally, you can use Instruments's Zombies template to debug crashes like this.

0

精彩评论

暂无评论...
验证码 换一张
取 消