iPhone - sending message to deallocated instance - why? <p>I keep geting this error and I just don't understand why. I am new to this so maybe someone can point out the problem.</p> <p>The error : </p> <pre><code>-[ShareXML release]: message sent to deallocated instance </code></pre> <p>The code:</p> <pre><code>if(self.share){ NSLog(@"SHARE ALREADY EXISTS"); [self.share startSomeProcess]; }else{ NSLog(@"share xml"); ShareXML *shareXML = [[ShareXML alloc] init]; self.share = shareXML; self.share.delegate = self; [self.share startSomeProcess]; NSLog(@"SHARE XML RELEASED"); [shareXML release]; } </code></pre> <p>ShareXML is an NSObject. I use almost identical code on a view controller and it works. Thanks!</p>