Click here to support Nimbus development and make a donation at !
An iOS framework whose growth is bounded by O(documentation).
NIDeviceInfo Class Reference


An interface for accessing device information.

This class is not meant to be instantiated. All methods are class implementations.

This class aims to simplify the interface for collecting device information. The low-level mach APIs provide a host of valuable information but it's often in formats that aren't particularly ready for presentation.

When using this class on the simulator, the values returned will reflect those of the computer within which you're running the simulator, not the simulated device. This is because the simulator is a first-class citizen on the computer and has full access to your RAM and disk space.

Definition at line 44 of file NIDeviceInfo.h.


(unsigned long long) + bytesOfFreeMemory
(unsigned long long) + bytesOfTotalMemory
Disk Space
(unsigned long long) + bytesOfFreeDiskSpace
(unsigned long long) + bytesOfTotalDiskSpace
(CGFloat) + batteryLevel
(UIDeviceBatteryState) + batteryState
(BOOL) + beginCachedDeviceInfo
(void) + endCachedDeviceInfo

Method Documentation

+ (unsigned long long) bytesOfFreeMemory

The number of bytes in memory that are free.

Calculated using the number of free pages of memory.

Definition at line 110 of file NIDeviceInfo.m.

+ (unsigned long long) bytesOfTotalMemory

The total number of bytes of memory.

Calculated by adding together the number of free, wired, active, and inactive pages of memory.

This value may change over time on the device due to the way iOS partitions available memory for applications.

Definition at line 121 of file NIDeviceInfo.m.

+ (unsigned long long) bytesOfFreeDiskSpace

The number of bytes free on disk.

Definition at line 135 of file NIDeviceInfo.m.

+ (unsigned long long) bytesOfTotalDiskSpace

The total number of bytes of disk space.

Definition at line 149 of file NIDeviceInfo.m.

+ (CGFloat) batteryLevel

The battery charge level in the range 0 .

. 1.0. -1.0 if UIDeviceBatteryStateUnknown.

This is a thin wrapper for [[UIDevice currentDevice] batteryLevel].

Definition at line 163 of file NIDeviceInfo.m.

+ (UIDeviceBatteryState) batteryState

The current battery state.

This is a thin wrapper for [[UIDevice currentDevice] batteryState].

Definition at line 169 of file NIDeviceInfo.m.

+ (BOOL) beginCachedDeviceInfo

Fetches the device's current information and then caches it.

All subsequent calls to NIDeviceInfo methods will use this cached information.

This can be a useful way to freeze the device info at a moment in time.


  [NIDeviceInfo beginCachedDeviceInfo];

  // All calls to NIDeviceInfo methods here will use the information retrieved when
  // beginCachedDeviceInfo was called.

  [NIDeviceInfo endCachedDeviceInfo];

Definition at line 181 of file NIDeviceInfo.m.

+ (void) endCachedDeviceInfo

Stop using the cache for the device info methods.

Definition at line 194 of file NIDeviceInfo.m.

Generated for Nimbus by doxygen 1.7.4-20110629