My app crashes with this (after the end of viewDidLoad):
-[NSPathStore2 release]: message sent to deallocated instance
A similar issue was reported in this question, but I'm not using any explicit NSPathStore2 instances, so I don't know where this is coming from. I know this is a memory-related issue, but I'm not sure how to track it down
What could be causing this overreleased NSPathStore2? What is an NSPathStore2?
NSPathStore2 is an internal object used by NSString for path work. You're almost certainly overreleasing an NSString somewhere in your code. The static analyzer will probably show you where: assuming you're using Xcode 4, choose Analyze from the Product menu.
Related
In an attempt to compile my iOS build, I get this error message. Anyone seen this before?
No known instance method for selector.
It means a selector sent to an object cannot be handled because the object (or its super) doesn't have corresponding methods, and the message forwarding process failed to handle it. You should check your code according to the error message and make sure the callings are correct.
I've been debugging for several hours, read some articles but still can't find what's wrong.
I've switched on ARC, but I found that my BIDGameScence will be deallocated strangely, and I don't know why.(I've checked that all pointer to BIDGameScene is strong.) I went through call stack when selector dealloc was called, but there's no selector written by myself in the stack(I think the last stack frame is a function used to send a message).
I also tried Zombies, but I just got Message send to deallocated object. An article says that I should use malloc_info, but I'm using lldb and got malloc_info is not a valid command.(I found that there is no gdb in my XCode.)
What's more, I added a NSLog statement in applicationDidReceiveMemoryWarning, but I did't find it in the logging.
Finally I tried to use Product->Analyze, but got nothing.
So, how to debug this error?
I'm using XCode 4.
Trying to find the source of this EXC_BAD_ACCESS in my iOS App. I get the following on the console:
[_UILayoutGuide isDescendantOfView:]: message sent to deallocated instance 0x7fd14037d0e0
And have used Zombies to try to track this down:
I can't find the source of the problem. Double clicking on any of the stack traces in Zombies doesn't lead to any of my code.
Hope you can help - before I bang my head too hard off the wall!
-Thanks
I finally found the answer - the problem was a constraint in the Storyboard.
The constraint was not "installed", but I found that by deleting UI elements one by one I could track down the problem constraint. No apparent reason why it would cause a crash like this, but deleting it has fixed the issue.
In my app, Thread 13 is marked as:
com.apple.root.default-overcommit-priority
Right below I see a:
0 __forwarding__
and below I have a:
6 _pthread_wqthread
Which causes:
-[CFString release]: message sent to deallocated instance
I understand that a message is being sent to a deallocated instance, my problem is I cannot find where that happens.
I have zombies enabled, exception logging, etc.
I have also created a framework which is imported (with full debug symbols), and I have a feeling that this is where the error originates from.
Since the framework is not executable directly, and has to be imported, how can I debug/step into it, etc, in order to try and find the exact line that triggers this problem?
Further more, How can I get more info about the crash, other than the assembly/stack/register info?
These lldb extensions are incredibly helpful for debugging. In your case, the bmessage command will allow you to set a breakpoint on [CFString release] so that you can get the trace and track down where release is being called twice on the same object.
https://github.com/facebook/chisel
I'm working on an iPad app in which I have a table view. When the user selects a row in the table, I use didSelectRowAtIndexPath to open a popover. I'm getting an error message saying "message sent to deallocated instance" when I try to use a certain button. I originally though the errors was getting thrown by the popover (in it's viewDidLoad or something), so I put a breakpoint in and stepped through the code. To my surprise, I was able to step all the way through the loading of the popover and the rest of the didSelectRowAtIndexPath on my table view (which actually just involves stepping out of some if blocks). The error then gets thrown when I get a couple steps into the automatically generated code that doesn't appear in any of my class files (that looks like 0x0010d71d <+1164> mov 0x6...).
So, my question is, how do I find where this error is being thrown? Is there another method that is automatically run after didSelectRowAtIndexPath that could be getting messed up somewhere?
Enable NSZombieEnabled in your DEBUG build (see How do I set up NSZombieEnabled in Xcode 4?) to locate instances of objects you're accessing that have been deallocated/released.
Also, consider upgrading your project to ARC, which will likely resolve memory management issues like this.
Okay, everyone's responses lead me to find malloc error -[CFString release], which helped me figure out I had a string in my popover that I alloc in viewDidLoad by
myString = [NSMutableString stringWithString:[myGlobalFunctionClass getMyString]];
Since I alloc it this way, it gets set to autorelease. The problem was I was explicitly [myString release]; and myString = nil; in viewWillAppear. Removing the release and =nil parts cleaned up my error.
To answer the actual question that I posted, I believe the autorelease wasn't firing until the simulator actually tried to display the popover (which would run after didSelectRowAtIndexPath). Since that occurs after I explicitly [myString release] in viewWillAppear, it was trying to autorelease something that was no longer there. Just to reiterate, the proper way to do it was let it autorelease at the end, and not [myString release] anywhere in my code.
Can someone verify that this is correct? As I mentioned in my comments, I'm still very new to iOS development. I have a feeling at the end of this project, I'm going to be able to go back to first stuff I did in it and make dozens of improvements in terms of doing things more efficiently and more in accordance with best practice.