title: purgeIdleCellConnections
body: <p>About the "duplicate" state of this question:<br>
  This question here was asked in Nov 2012, it contains a detailed description of the problem and has 3 answers.<br>
  The question referred to as "original" was asked in Feb 2013 (3 month after this "duplicate"), has no detailed description and only 2 answers. The best of its two answers is just a link-only-answer.</p>
  
  <hr>
  
  <p><strong>Why do I get this message in my console?:</strong></p>
  
  <pre><code>purgeIdleCellConnections: found one to purge conn = (some object-ID)
  </code></pre>
  
  <hr>
  
  <p>When my App starts I send a message to my server. I do this with this lines of code:</p>
  
  <pre><code>@implementation AppStatus {
      NSMutableData*   activeDownload;
      NSURLConnection* Connection;
  }
  
  - (id) init {
      self = [super init];
      if (self) {
          activeDownload = nil;
          Connection     = nil;
      }
      return self;
  }
  
  - (void)sendStatus:(NSString*)url {
      NSString* escaped = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
      NSURLConnection* conn =[[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:escaped]] delegate:self];
      Connection = conn;
      NSLog(@"%s Connection=%@",__PRETTY_FUNCTION__,Connection);
  }
  </code></pre>
  
  <p>In the same file I have this delegate-methods:</p>
  
  <pre><code>- (void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data {
      NSLog(@"%s connection=%@",__PRETTY_FUNCTION__,connection);
      [activeDownload appendData:data];
  }
  
  - (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error {
      NSLog(@"%s connection=%@",__PRETTY_FUNCTION__,connection);
      activeDownload = nil;
      Connection = nil;
      //do nothing else; just ignore the error
  }
  
  - (void)connectionDidFinishLoading:(NSURLConnection*)connection {
      NSLog(@"%s Connection=%@",__PRETTY_FUNCTION__,Connection);
      NSString* answer = [[NSString alloc] initWithData:activeDownload encoding:NSUTF8StringEncoding];
      //do something usefull with the server's answer
      activeDownload = nil;
      Connection = nil;
  }
  </code></pre>
  
  <p>When i run this app on a real device (not on the simulator), I get this messages in the console:</p>
  
  <pre><code>2012-11-22 20:41:51.309 BookMan[376:907] -[AppStatus sendStatus:] Connection=&lt;NSURLConnection: 0x1dd7ff40&gt;
  2012-11-22 20:41:51.929 BookMan[376:907] -[AppStatus connection:didReceiveData:] Connection=&lt;NSURLConnection: 0x1dd7ff40&gt;
  2012-11-22 20:41:51.935 BookMan[376:907] -[AppStatus connectionDidFinishLoading:] Connection=&lt;NSURLConnection: 0x1dd7ff40&gt;
  purgeIdleCellConnections: found one to purge conn = 0x1dd8ff60
  </code></pre>
  
  <p>The purgeIdleCellConnections-message apears about 4 or 5 seconds after the connectionDidFinishLoading-message.  </p>
  
  <p>As you can see, the object-number of the purgeIdleCellConnections-message is not the same as the number of the connection I did create and use in my app.</p>
  
  <p>Maybe IMPORTANT: I do get this message only when I run the App on a real device (iPhone 4 with iOS 6.0.1). This device uses a 3G-connection, not a WIFI-connection. At the moment I have no WIFI-network to test if this happens on a WIFI-connection too.<br>
  I do not get this message when I run the App on the simulator.  </p>
  
  <p>When I change the method sendStatus: to this:</p>
  
  <pre><code>- (void)sendStatus:(NSString*)url {
      NSString* escaped = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
      //NSURLConnection* conn =[[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:escaped]] delegate:self];
      //Connection = conn;
      NSLog(@"%s Connection=%@",__PRETTY_FUNCTION__,Connection);
  }
  </code></pre>
  
  <p>I get this output in the console:</p>
  
  <pre><code>2012-11-22 20:45:11.927 BookMan[391:907] -[AppStatus sendStatus:] Connection=(null)
  </code></pre>
  
  <p>I do not get the purgeIdleCellConnections-message when I do not create a connection.</p>
  
  <hr>
  
  <p><strong>So what does this message mean and why do I get it?:</strong></p>
  
  <pre><code>purgeIdleCellConnections: found one to purge conn = (some object-ID)
  </code></pre>