I have noticed that some apps like Safari and Mail show a loading indicator in the status bar (the bar at the very top of the phone) when they are accessing the network. Is
It might also be helpful to make sure you are running it on the main thread as it is UI related.
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
});
You need to take care of hiding the activity indicator also once your network call is done.
If you use AFNetworking
, then you don't need to do much.
Do following changes in AppDelegate
Class:
Import AFNetworking/AFNetworkActivityIndicatorManager.h
Put this in didFinishLaunchingWithOptions:
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]