How do i resolve EXC_BAD_ACCESS errors encountered in iphone development

后端 未结 8 595
执念已碎
执念已碎 2020-12-13 20:54

I\'m trying to do a simple thing; read an image from the internet, save it to the app\'s documents directory on the iphone, and read it back from that file so that i can do

8条回答
  •  一向
    一向 (楼主)
    2020-12-13 21:52

    In general though, if you're getting EXC_BAD_ACCESSs in your code and you can't for the life of you figure out why, try using NSZombie (no, I'm not kidding).

    In Xcode, expand the Executables section on the left. Double click on the listing that has the same name as your project (it should be the only one). In the window that pops up, go to Arguments, and in the bottom portion, click the plus button. The name should be NSZombieEnabled and the value should be set to YES

    This way, when you try to access a released object, you'll have a better of what you're doing. Just set the value to NO once you've figured out the bug.

    Hope this helps someone!

提交回复
热议问题