title: My app crashes if I change the control view repeatedly
body: <p>I have an app that reads from a database some data ( ASIFormDataRequest ) and some images from server files ( setImageWithURL ). My app does it every time the viewController is changed (in order to have everything updated). So I guess there is an issue with cached images  If I push my app to the limit switching viewControllers repeatedly my app crashes. Why is this?</p>
  
  <p>All of this has appeared after adding the setImageWithURL functions. Has anyone run into something similar? </p>
  
  <p>I may have to change the way my app works  How do you guys do these calls to the server/SQL? How often?</p>
  
  <p><strong>EDITED:(NON_ANSWERED YET ):</strong></p>
  
  <p>XCODE does not say anything about it , when my device crashes it only displays:</p>
  
  <blockquote>
    <p>2011-12-29 20:14:56.479 CaeDeCajon[4969:6e4f]  arrayProductos.id :13
    id_producto: 31 2011-12-29 20:14:56.481 CaeDeCajon[4969:7b5f] 
    arrayProductos.id :25 id_producto: 15 2011-12-29 20:14:56.490
    CaeDeCajon[4969:7b5f]  arrayProductos.id :31 id_producto: 15
    2011-12-29 20:14:56.491 CaeDeCajon[4969:7b5f]  arrayProductos.id :32
    id_producto: 15 2011-12-29 20:14:56.395 CaeDeCajon[4969:955f] 
    arrayProductos.id :22 id_producto: 35 (gdb)    // HERE IT STOPS
    RUNNING.</p>
  </blockquote>
  
  <p>for a better understanding of the question, my app is designed as follows:</p>
  
  <ul>
  <li><p>Based on a 5-icon TabBar.</p></li>
  <li><p>In the second icon I have a tableview with categories of products ( tables, chairs ... ) and if you press on one of them appears another viewController ( the usual detail view ) showing several products in a row ( thanks to a scrollView ) , here there is a navigationController with a button on it, when pressed it takes you to the gallery mode: showing the same products that were shown in the scrollView but in a gallery mode, if you press one of the products it takes you back to the scrollView and move your screen to the product chosen. Pretty normal stuff . </p></li>
  <li><p>In the third icon I have the check-out basket, where every product picked up on the scrollView (where there is a buy button  ) is pressed.</p></li>
  </ul>
  
  <p>The case is that I "read" Asycn from the database all the information(no pictures) at launchingWithOptions and every time the viewController is changed, to make sure the user does not pick up a product that was sold out. I implanted this on its own and it seemed to worked fine and not to crash my app ( info : name, stock, ... only strings ). light data.</p>
  
  <p>Here is where I think the problem is: I "read" all the images display from a file system in 1&amp;1 ( hosting compony ), and seems to work fine and fast. The problem is when I swap/change the viewController repeatedly and quick between tableView-ScrollView-galleryMode , it crashed 4 times in a row for the same reason. I must say that I get the images for every viewController, for example the images in the scrollView,galleryMode and checkoutView are the same . Can I reuse them ? because I have calls to the URL everyViewController and I guess that is not healthy.</p>
  
  <p>The code to download images:</p>
  
  <blockquote>
  <pre><code>NSString *URLphotos =[[NSString alloc]initWithFormat:@"http://www.myurl.com/imagenes/%@",picture1.jpg]; // this is not always picture1.jpg but I changed it for making it plainer.
  </code></pre>
    
    <p>[cell.photo  setImageWithURL:[NSURL URLWithString:URLphotos]
    placeholderImage:[UIImage imageNamed:@"placeHolder.png"]] ;</p>
  </blockquote>
  
  <p>Is it enough? I got no more.</p>
  
  <p>wanted tips: </p>
  
  <ul>
  <li>How/where do you guys "read" the images from the URL in order not to crash the app but have the app updated all the time?</li>
  <li>Is there something going on with my cache that is making me crazy ? fix it?</li>
  </ul>
  
  <p>Thanks in advance for the interest</p>