How to turn on the network indicator in the iOS status bar? [duplicate]

Solution 1:

Swift

UIApplication.sharedApplication().networkActivityIndicatorVisible = true

Swift 5 , Swift 4.x , Swift 3.x

UIApplication.shared.isNetworkActivityIndicatorVisible = true

Update for iOS 13, 14

There will be no network indicator displayed from iOS 13.

The deprecation message says:

Provide a custom network activity UI in your app if desired.

Solution 2:

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];