I understand that in order to facilitate the testing process, one should use dependency injection as a design principle. If I'm not wrong, instead of allocating an object I'm going to use, I should declare it as public and let someone else do the job; in this case when testing and creating the mock. However, in order to use the real object, eventually, I will have to allocate it. But, where?
I used lazy instantiation to allow the mock object to take place over the real one, and when it does't, when I'm running the app, the real object will be used. It gets the job done but I was told that it's not a good practice to use lazy instantiation in that way; specially, when the object to be allocated requires different parameters. For example, a NSURLConnection.
The class using the object is a ViewController, so it is the last "client". There's no other class that I can delegate the allocation of the object, and if I allocated it in, let's say, viewDidLoad then I won't be able to mock that object.