iphone - Objective-C NSURLConnection -
Can I have all connection related functions on my own (singleton?) Class or possibly app representative?
I've got too many code repeats ...
e.g. This method is in at least 5 files:
- (zero) connection: (NSURLConnection *) connection made FailWithError: (NSError *) error;
Should I import a square with these methods in this method? Do I have to expand or use them?
I do not recommend a singleton approach for a NSURLConnection
handler, Mainly because each URL connection is different and it may be necessary to handle it differently.
It seems that you have a lot of code repetition if you have simple requests, but as you begin to make more complex requests, and parsing different requests will give you different responses, you Soon, it will start to see that a general approach will not save you from writing more specific implementations.
Comments
Post a Comment