Skip to content

Instantly share code, notes, and snippets.

@Veraticus
Created January 31, 2013 19:18
Show Gist options
  • Save Veraticus/4685566 to your computer and use it in GitHub Desktop.
Save Veraticus/4685566 to your computer and use it in GitHub Desktop.
class AppDelegate
attr_accessor :moviesViewController, :notificationsViewController, :tabBar
def application(application, didFinishLaunchingWithOptions:launchOptions)
...
# Reachability
ServerClient.sharedInstance.setupReachability
AFNetworkActivityIndicatorManager.sharedManager.enabled = true
...
end
end
Motion::Project::App.setup do |app|
...
app.pods do
pod 'Reachability'
end
...
end
class ServerClient < AFHTTPClient
def setupReachability
self.operationQueue.maxConcurrentOperationCount = 1
self.operationQueue.suspended = true
@reachability = Reachability.reachabilityWithHostname(ServerClient.hostname)
@reachability.reachableBlock = lambda {|reachable| ServerClient.sharedInstance.operationQueue.suspended = false}
@reachability.unreachableBlock = lambda {|reachable| ServerClient.sharedInstance.operationQueue.suspended = true}
@reachability.startNotifier
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment