My app gets some json data from a server and it uses a NSMUtableData object to store these data.
But debugger is reporting the following error:
[NSCFString setLength:]: unrecognized selector sent to instance
and the debugger highlighted the following line (in connection didReceiveResponse method):
[rqst_data setLength:0];
rqst_data is declared as NSMutableData in header file.
Thx in advance for your kind help,
Stephane
It seems your
rqst_datavariable gets released. Make sure you have properly allocated it. If you have declared@propertyfor it you better use the variable asself.rqst_data.You can use
retainand in case of IOS 5strongin property declaration.You can track if any variable gets released via setting
NSZombieEnabledtoYES. With zombies enabled, messages to deallocated objects will no longer behave strangely or crash in difficult-to-understand ways, but will instead log a message and die in a predictable and debugger-breakpointable way.You can set
NSZombieEnabledby the following steps.Select Product from the menu bar above. Keep alt/option pressed and select “Test…” or “Run…”.
1.
Go to the Arguments tab, and add
NSZombieEnabledYESin the “Environment Variables” section.OR
2.
Go to the Diagnostics tab, and check
Enable Zombie Objectsin the “Memory Management” section.