Search code examples
iphonememorynsstringdealloccfstring

iphone: -[CFString release]: message sent to deallocated instance


an app I'm working on keeps crashing when run on the iPhone but not on the Simulator (although a warning is shown when run without symbolic malloc_error_break, but the app keeps working on the Sim)

I'm not manually releasing any string, instead, i use:

[[[NSString / NSMutableString alloc] init] autorelease]; 

(which I do all the time for other apps and have never given me a problem)

Now when I set malloc_error_break as a breakpoint I get:

2012-03-07 17:04:06.072 columns[15487:f803] *** -[CFString release]: message sent to deallocated instance 0x68c8210

With XCODE4 jumping to:

int main(int argc, char *argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");   >>> Thread 1
    [pool release];
    return retVal;
 }

I also have NSZombieEnabled when run on the simulator btw

If anyone can help me on how to debug this on XCODE 4 or point me to a tutorial online that would be much appreciated!

Regards

david


Solution

  • Remove autorelease from your NSString methods and add them back in until it crashes (I guess this is the answer now, so...)