Search code examples
automatic-ref-countingwatchkitwatchos-2dealloc

WatchKit without ARC causes crash when dealloc


The watch app I am developing is not using ARC. And so I releases all the properties of objects in each interface in dealloc as below.

-(void)dealloc {

  [obj1 release];
  [obj2 release];
   ...
  [super dealloc];
}

This causes crash when i close the interface (for example to go back to main interface). Why is this so?


Solution

  • Retains and releases need to be balanced in the context of your class. Probably you didn't retain when you assigned to one of those instance variables, and thus it's an over-release. You can try enabling zombies to catch the message to a deallocated instance if that's the case.