0

First time using AFNetworking (and also a part-time iOS dev) and have a quick question (and very basic question). How do we use setReachabilityStatusChangeBlock? We have a singleton class called ApiClient that makes all of our calls.

I would think ideally we would want to be setting this in the common method to return the singleton. I see this AFNetworking (AFJSONRequestOperation) convert to AFHTTPClient but honestly, I just don't get where / how we are calling this method.

Secondarily, I'd like to return a non-reachable controller (or provide a way for it to 'redirect' to a non-reachable controller). How would I do this?

thx in advance

Community
  • 1
  • 1
timpone
  • 19,235
  • 36
  • 121
  • 211
  • This might help: http://stackoverflow.com/a/11612051/653513 – Rok Jarc Nov 23 '12 at 18:11
  • thx - so, possibly a dumb question, but if we have a singleton and the reachability changes during the life of the app which could be a very long time, will this get executed correctly? Or is this only run when the app starts? I know this is getting somewhat application specific but I'd like to find a good canonical singleton solution since I don't have any experience with AFNetworking and am sure this has been done a bunch of times. – timpone Nov 23 '12 at 20:21
  • This block will execute each time the reachability status changes. You could try that running on phone only on WiFi turning the access point off during debugging. Docs on this function: http://afnetworking.github.com/AFNetworking/Classes/AFHTTPClient.html#//api/name/setReachabilityStatusChangeBlock: – Rok Jarc Nov 23 '12 at 21:21

0 Answers0