title: Stubbing/mocking up webservices for an iOS app
body: <p>I'm working on an iOS app whose primary purpose is communication with a set of remote webservices. For integration testing, I'd like to be able to run my app against some sort of fake webservices that have a predictable result. </p>
  
  <p>So far I've seen two suggestions:</p>
  
  <ol>
  <li>Create a webserver that serves static results to the client (for example <a href="http://darioalessandro.wordpress.com/2012/01/22/mocking-http-ws-using-apache-codeigniter-mac-os-x/" rel="nofollow noreferrer">here</a>). </li>
  <li>Implement different webservice communication code, that based on a compile time flag would call either webservices or code that would load responses from a local file (<a href="http://www.touchbee.com/2011/08/apps-and-mock-web-services/" rel="nofollow noreferrer">example</a> and <a href="https://stackoverflow.com/questions/3492419/mockup-webservice-for-iphone">another one</a>).</li>
  </ol>
  
  <p>I'm curious what the community thinks about each of this approaches and whether there are any tools out there to support this workflow.</p>
  
  <p><strong>Update</strong>: Let me provide a specific example then. I have a login form that takes a username and password. I would like to check two conditions:</p>
  
  <ol>
  <li><em>wronguser@blahblah.com</em> getting login denied and</li>
  <li><em>rightuser@blahblah.com</em> logging in successfully.</li>
  </ol>
  
  <p>So I need some code to check the <em>username</em> parameter and throw an appropriate response at me.  Hopefully that's all the logic that I need in the "fake webservice". How do I manage this cleanly?</p>