Finding XCode errors due to deallocated instances

There is nothing more irritating then the msg( debugger console) that are like this;
-[NSFetchedResultsController class]: message sent to deallocated instance <some ddress>
In order to track the erros which occur when you access the deallocated instance of an object
All you need to do is few changes in environment variables

step 1.Go to edit schemes

step 2.Add MallocStackLOggingNoCompact   value 1 and NSZombieEnabled















Step 3. Set the enable zombie object in diagnostics


(be sure to disable these after testing. They should not be enabled for final build)

execute your program till crash you will get a hex message use it with the command given below

(gdb) info malloc-history <paste-address-here>
You will get the code line where the object was allocated
 
 
 
A pat on the back !!

Leave a Reply

Your email address will not be published. Required fields are marked *