开发者

Waiting for iPhone Memory Management

开发者 https://www.devze.com 2022-12-09 23:48 出处:网络
I am receiving a EXC_BAD_ACCESS when I am presenting another controller in Modal view.Apparently, when I get to that controller\'s viewDidLoad, s开发者_如何学JAVAome variables are \"invalid\".However,

I am receiving a EXC_BAD_ACCESS when I am presenting another controller in Modal view. Apparently, when I get to that controller's viewDidLoad, s开发者_如何学JAVAome variables are "invalid". However, if I wait like 20 seconds, then the controller will load fine.

I am new to iPhone. Sorry for a newbie question.


I wrote this blog about some techniques for tracking this down:

http://loufranco.com/blog/files/debugging-memory-iphone.html

The upshot is that you can run the application in a mode that will detect a lot of common memory problems.


Often EXC_BAD_ACCESS can be tracked by just running the debugger. Don't set any break points, just run in debug (Command-Y) and do what you normally do to cause the app to crash. The debugger will stop at the place in the code where the crash is happening. You can then look at the threads list in the debugger (upper left view) and see the last line of your code that was valid. Lines that are in a gray font are lines from internal code. Lines in a full black font are your code. Click on the last (top most in the stack) of your lines of code and you can see where it's failing. You can then hover your mouse over the variables in that line to find the one that has not been initialized. This should give you and idea of what is happening.

0

精彩评论

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

关注公众号