How to mock network requests in iOS

One of the challenges of mobile application development is to ensure that the application is resilient to various error responses from the services that are consumed by the application. Mobile devices are more susceptible to network connectivity issues, timeout etc. So we need to take extra care to make sure that we test all error scenarios and handle them in a meaningful manner. What and Why of Mocking Even though we are convinced about the benefits of testing server errors, these services are running in Production serving real customer requests.