Closed mattt closed 13 years ago
Thanks A LOT for your help, mattt.
I was keeping BaseViewController just for some short-hand methods and for keeping a shared NSOperationQueue for all requests in a ViewController. And I was keeping ImageManager because I thought it was necessary to verify AFImageCache before doing the request. But as I can see this is not necessary.
Nevertheless I have fixed a few things. See this commit: https://github.com/gimenete/iOS-boilerplate/commit/d742b82cce5b9bad6e6fe81edde873b50ae18095
Basically two things.
Thanks again. I will update the web site ASAP with these new changes.
Hi Alberto,
Thanks so much for choosing AFNetworking to replace ASIHTTPRequest in your iOS Boilerplate. I hope you've found it nice to work with so far.
Looking through your use of AFNetworking in the project, I have a few suggestions (with patchesI) for how to reduce and clean up the code a bit. These suggestions stem from a difference in how ASI is used as compared to AF.
-requestWithURL:
andmutableRequestWithURL:
provide little advantage over simply using the class constructors fromNSURLRequest
andNSMutableURLRequest
. Likewise, the different request methods are sort of an anti-pattern. For single requests, those operation objects should simply use the class constructors defined in the class (e.g.AFJSONRequestOperation +JSONRequestOperationWithRequest:success:failure
. For things like requesting data from the same API (like Twitter, see point 3), AFHTTPClient handles that just fine. I would strongly advise against the current use of AFNetworking in the controllers for these reasons.I look forward to hearing your thoughts on these changes.