The iOS framework that grows only as fast as its documentation
Network Activity

Functions

void NINetworkActivityTaskDidStart (void)
 
void NINetworkActivityTaskDidFinish (void)
 

For Debugging Only

Methods that will only do anything interesting if the DEBUG preprocessor macro is defined.

void NIEnableNetworkActivityDebugging (void)
 
void NIDisableNetworkActivityDebugging (void)
 

Overview

For showing network activity in the device's status bar.

Two methods for keeping track of all active network tasks. These methods are threadsafe and act as a simple counter. When the counter is positive, the network activity indicator is displayed.

Function Documentation

NINetworkActivityTaskDidStart

Increment the number of active network tasks.

void NINetworkActivityTaskDidStart:;
Discussion

The status bar activity indicator will be spinning while there are active tasks.

This method is threadsafe.

NINetworkActivityTaskDidFinish

Decrement the number of active network tasks.

void NINetworkActivityTaskDidFinish:;
Discussion

The status bar activity indicator will be spinning while there are active tasks.

This method is threadsafe.

NIEnableNetworkActivityDebugging

Enable network activity debugging.

void NIEnableNetworkActivityDebugging:;
Discussion
Attention
This won't do anything unless the DEBUG preprocessor macro is defined.

The Nimbus network activity methods will only work correctly if they are the only methods to touch networkActivityIndicatorVisible. If you are using another library that touches networkActivityIndicatorVisible then the network activity indicator might not accurately represent its state.

When enabled, the networkActivityIndicatorVisible method on UIApplication will be swizzled with a debugging method that checks the global network task count and verifies that state is maintained correctly. If it is found that networkActivityIndicatorVisible is being accessed directly, then an assertion will be fired.

If debugging was previously enabled, this does nothing.

NIDisableNetworkActivityDebugging

Disable network activity debugging.

void NIDisableNetworkActivityDebugging:;
Discussion
Attention
This won't do anything unless the DEBUG preprocessor macro is defined.

When disabled, the networkActivityIndicatorVisible will be restored if this was previously enabled, otherwise this method does nothing.

If debugging wasn't previously enabled, this does nothing.