开发者

iOS App crashes due to 'message sent to deallocated instance'

My iOS app has lots of network feat开发者_StackOverflow中文版ures. I of course save important data to the filesystem for offline viewing and so on, and it used to work perfectly without any problems. Now, when I try to test this with Airplane mode on to simulate no internet connection, GDB outputs this:

2011-04-17 21:34:13.291 Bronto Backup Mobile App[195:307] *** -[UIAlertView release]: message sent to deallocated instance 0x3e93630

I have tried malloc debug in gdb, but it tells me the process isn't running or that the command is not found. How would I go about figuring out where the bug happened? backtrace gave me nothing but the usual NSAutoreleasePoolPop stuff.

For the love of me, I just can not track down where this bug is. NSZombiesEnabled tells me the address, but the malloc_history pid 0x3e93630 is just plain out throwing me an error, saying that gdb does not know this command, even with info in front.


Something is being under-retained or over-released. Run your app in Instruments using the Zombies template. That will show you what object had the memory issue, and will let you see the entire retain/release history of that object. That should point you in the right direction.


BJ Homer's answer is correct, please don't upvote my answer. Here is some further information I posted:

https://stackoverflow.com/a/19237139/539149

I had a place that said:

[viewController release];
viewController = NULL;

Which caused release to be called twice (so the memory was freed immediately) but the zombie wasn't revealed until an object owned by iOS tried to reference the object later in the main thread.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜