iOS System Utilities

iOS System Utilities

System Utilties is a class for acquiring details for device, memory, network, media, folder and process areas. Over 120 methods for determining everything from: device specs, battery life, SIM, SSID, BSSID, network stats, CPU, GPU, IP addresses, camera details, disk space, memory usage, Bonjour services, AirPlay services and location details. Includes full source code and a working demo.

SystemUtilities is a class containing over 120 static methods providing must-have or missing utilities acquiring all available information about your device. Querying Running and Killed Processes, Memory Usage, Disk Usage, Device Resolution, Screen Resolution, Mirroring, MAC, WiFi SSID (network name), CPU Usage, Network Tx (transmitted byte count) and Rx (received byte count), WiFi and WWAN Tx and Rx, Cell and IP Address, File Utilities, device specifications and much more. For iPad, iPhone and iPod Touch.

The best demonstration of using SystemUtilities is the iMySystem app on the Apple AppStore: https://itunes.apple.com/us/app/imysystem/id386010338?mt=8. The last two screenshots provided are of the iMySystem app.

An invaluable collection of utilities providing a wealth of information much not readily available using the iOS SDK.

Using System Utilities in your app

Copy the installation zip SystemUtilities folder to your project and keep everything in the SystemUtilities folder. Then in your project import SystemUtiltiies.h and use the static methods to acquire desired details.

Included Utilities

Utilities provided include getting the following information:

  • System uptime
  • Processor details
  • CPU and GPU
  • Attached accessories information
  • Phone carrier information
  • Battery level, status and life
  • Device details such as model, name, system name and version
  • Device type and real type
  • Siri and TouchID availability
  • Device type and real type
  • Type of connection - WiFi or Cell
  • WiFi SSID (network name) and BSSID
  • Graphics Benchmarks
  • SIM
  • Carrier name
  • Mirroring
  • Device type and real type
  • Network Tx (transmitted byte count) and Rx (received byte count)
  • WiFI and WWAN Tx and Rx
  • MAC addresses
  • Cell address and IP Address
  • Network mask for WiFi
  • Broadcast IP or WiFi
  • Media details such as total photos and videos and their disk size
  • Media details for new photos and videos and their total disk size
  • Media details such as songs, albums and podcasts.
  • Running process details with tracking of terminating processes.
  • Disk space and memory details
  • Text to Speech API using Google Voice and Translate
  • File utilities and more.

It's tested and works well on iOS6+ and iOS8+.

See Static Methods section below for the full lists of available methods.

Hide

Static Methods

// System Utility Functions

// New methods for v4.2

+ (BOOL)hasSiri;             // determine if device has Siri
+ (BOOL)hasTouchID;    // determine if device has TouchID

// NEW in 3.7

+ (CGFloat)getScreenBrightnes;      // get screen brightness (from 0.0 to 1.0)
// set screen brightness - value from 0.0 to 1.0
+ (BOOL)setScreenBrightness:(CGFloat)brightness;
//
// get the device resolution
//
// return UIDeviceResolution_Unknown          = 0
//        UIDeviceResolution_iPhoneStandard   = 1   iPhone 1,3,3GS Standard Display  (320x480px)
//        UIDeviceResolution_iPhoneRetina4    = 2   iPhone 4,4S Retina Display 3.5"  (640x960px)
//        UIDeviceResolution_iPhoneRetina5    = 3   iPhone 5 Retina Display 4"       (640x1136px)
//        UIDeviceResolution_iPadStandard     = 4   iPad 1,2,mini Standard Display   (1024x768px)
//        UIDeviceResolution_iPadRetina       = 5   iPad 3 Retina Display            (2048x1536px)
 + (UIDeviceResolution)getDeviceResolution;   
 + (NSString *)getDeviceResolutionStr:(BOOL)includeDeviceName;    // get the device resolution
 + (NSString *)getScreenResolution;   // get the screen resolution details
 + (CGRect)getScreenRect;             // get screen rect
 + (CGRect)getScreenAppRect;          // get screen appication rect
 + (int)getScreenWidth;               // get screen width
 + (int)getScreenHeight;              // get screen height
 + (CGFloat)getScreenScale;           // get screen scale
 + (BOOL)isScreenRetina;              // is screen retina.  TRUE = retina, else not retina.

//  end of NEW in 3.7

// formats text into lines of a max length with all lines being on word breaks
+ (NSMutableArray *)formatTextLine:(NSString *)text maxLength:(int)maxLength;

// get network data counters (WiFi and WWAN)
//
// return NSArray of 4 NSNumber unsigned int counters
//        [0] WiFi Sent, [1] WiFi Received, [2] WWAN Sent,  [3] WWAN Received
+ (NSArray *)getNetworkDataCounters;  

// General file utilities:

// determine if the file at the path exists
+ (BOOL)doesFileAtPathExist:(NSString *)path;

// determine if the file at the url exists
+ (BOOL)doesFileExist:(NSURL *)fileUrl;

// delete the file at the specified path
+ (BOOL)deleteFileAtPath:(NSString *)path;

// delete the file at the specified url
+ (BOOL)deleteFile:(NSURL *)fileUrl;

// Text to Speech methods:

// read specified text - include linebreaks for multiple lines and will speak each line
+ (BOOL)readText:(NSString *)text;

// read specified text - include linebreaks for multiple lines and will speak each line
// wait specifies whether to wait for the audio to be done playing
+ (BOOL)readText:(NSString *)text wait:(BOOL)wait;

// read specified text for single line
// wait specifies whether to wait for the audio to be done playing
+ (BOOL)readTextLine:(NSString *)text wait:(BOOL)wait;

// get the reading text language code (e.g. en, fr, es)
+ (NSString *)getReadingLocaleLanguageCode;

// get a description for the reading locale being used
+ (NSString *)getReadingLocaleDescription;

// get the locale used for reading text
// locale specifies the locale to use.  If nil then default of current locale used
+ (NSLocale *)getReadTextLocale;

// set the locale used for reading text
// locale specifies the locale to use.  If nil then default of current locale used
+ (void)setReadTextLocale:(NSLocale *)locale;

// get list of available
//
// return NSArray of localeIdentifiers (e.g. en, fr, es)
+ (NSArray *)getAvailableLocaleIdentifiers;

// read specified text - works best with single lines
//
// return file system path of the created audio file readtextfile.mp3 (default filename)
+ (NSString *)getAudioFileForText:(NSString *)text;

// read specified text - works best with single lines
// name specified name of output audio file (e.g. readtextfile.mp3)
//
// return file system path of the created audio file with your name
+ (NSString *)getAudioFileForText:(NSString *)text name:(NSString *)name;

// play audio file at specified path
// wait specifies whether to wait for the audio to be done playing
+ (BOOL)playAudioFileUsingPath:(NSString *)audioFilePath wait:(BOOL)wait;

// play audio file at specified URL
// wait specifies whether to wait for the audio to be done playing
+ (BOOL)playAudioFile:(NSURL *)audioFileUrl wait:(BOOL)wait;

+ (NSString *)getDeviceResolution:(BOOL)includeDeviceName;    // get the device resolution e.g. 'iPhone Retina 3.5", iPhone Retina 4", iPad Standard...'
// if includeDeviceName  FALSE returns 'Retina 3.5", Retina 4", Standard...' without device name
+ (NSString *)getScreenResolution;   // get the screen resolution details
+ (BOOL)isMirroringSupported;        // is mirroring supported and active.  TRUE = yes and active, FALSE - no
// END OF NEW

// NEW in version 2.0
+ (NSString *)getCPUUsageAsStr;        // CPU usage in string format
+ (NSString *)getCPUTimeCurrentThreadAsStr;  // CPU time for current thread in string format
+ (NSString *)getCPUTimeAllThreadsAsStr;     // CPU time for all threads in string format

// new in version 4.1
+ (NSString *)getDNSServers;         // get DNS Servers information
// end of new in version 4.1

+ (NSString *)getSSIDForWifi;            // get the WiFi SSID (network name)
+ (NSString *)getBSSIDForWifi;         // get the WiFi BSSID
+ (NSString *)getNetworkNameForWifi;   // get the WiFi network name (SSID)

+ (NSString *)getTxStr;                   // get network bytes sent as string
+ (NSString *)getNetworkTxStr;    // get network bytes sent as string
+ (NSString *)getRxStr;                   // get network bytes received as string
+ (NSString *)getNetworkRxStr;    // get network bytes received as string

+ (u_long)getNetworkTx;                // get network Tx bytes sent
+ (u_long)getNetworkBytesTransmitted;  // get network bytes sent
+ (u_long)getNetworkRx;                // get network Rx bytes received
+ (u_long)getNetworkBytesReceived;     // get network bytes received
// END OF NEW

+ (NSString *)getSystemUptime;    // system uptime in days, hours, minutes e.g. 1d 0h 7min

+ (NSString *)getProcessorInfo;   // procssor information including number of processors and number of processors active
+ (NSString *)getCPUFrequency;    // processor CPU speed (MHz)
+ (NSString *)getBusFrequency;    // processor BUS speed (MHz)

+ (NSString *)getAccessoryInfo;   // information on any accessories attach to the device

+ (NSString *)getCarrierInfo;     // phone carrier information including carrier name, carrier country and whether VOIP is allowed  
+ (NSString *)getCarrierName;     // phone carrier name
+ (NSString *)getCarrierMobileCountryCode;  // phone carrier mobile country code
+ (NSString *)getCarrierISOCountryCode;     // phone carrier ISO country code
+ (NSString *)getCarrierMobileNetworkCode;  // phone carrier mobile network code
+ (BOOL)doesCarrierAllowVOIP;     // whether phone carrier allows VOIP (Voice over IP)
+ (NSString * )getMCC_country:(NSString *)carrierMobileCountryCode;  // mobile country for mobile country code
+ (NSString *)getCountry:(NSString *)_countryCode;  // country for country code

+ (NSString *)getBatteryLevelInfo;  // battery level information including percent charges and whether plugged in and charging
+ (float)getBatteryLevel;           // battery level percentage charged

+ (NSString *)getUniqueIdentifier;  // unique identifier for the device

+ (NSString *)getModel;             // model of the device
+ (NSString *)getName;              // name identifying the device
+ (NSString *)getSystemName;        // name the operating system (OS) running on the device
+ (NSString *)getSystemVersion;     // current version of the operating system (OS)

+ (NSString *)getDeviceType;        // device type e.g. 'iPhone4,1' for 'iPhone 4' and 'iPad3,3' and 'New iPad'
+ (NSString *)getRealDeviceType;    // real device type e.g. 'iPhone4,1' real device type is 'iPhone 4'
+ (NSString *)getDeviceTypeAndReal; // device type and real device type e.g. 'iPhone 4,1 iPhone 4'

+ (BOOL)onWifiNetwork;               // Determine if on Wifi network.  TRUE - yes, FALSE - no
+ (BOOL)on3GNetwork;                 // Determine if on a 3G (or 4G) network,  TRUE - yes, FALSE - no
+ (NSMutableArray *)getMacAddresses; // MAC (Media Access Control) addresses    
+ (NSString *)getCellAddress;        // Cell phone IP address (on 4G, 3G etc. network.  Note: getMacAddresses must be called beore getCellAddress)
+ (NSString *)getIPAddress;          // Device IP address on 
+ (NSString *)getIPAddressForWifi;   // IP address for Wifi
+ (NSString *)getNetmaskForWifi;     // Network mask for Wifi
+ (NSString *)getBroadcastForWifi;   // Boardcast IP address or Wifi

+ (NSMutableArray *)getAppLog:(NSString *)_name verbose:(BOOL)_verbose;  // Application log for a specific application

+ (NSMutableArray *)getProcessInfo;   // Process information including PID (process ID), process name, PPID (paren process ID) and status
+ (int)getParentPID:(int)pid;         // PID (parent ID) for a PID (process ID)

+ (NSString *)getDiskSpace;           // Total disk space formatted
+ (NSString *)getFreeDiskSpace;       // Free disk space formatted
+ (NSString *)getFreeDiskSpaceAndPct; // Free disk and percent disk free formatted
+ (NSString *)getFreeDiskSpacePct;    // Disk space free percentage formatted
+ (NSString *)getFreeMemoryAndPct;    // Free memory and percent memory free formatted
+ (NSString *)getUsedMemoryPct;       // Used memory percentage formatted
+ (long long)getlDiskSpace;           // Total disk space
+ (long long)getlFreeDiskSpace;       // Free disk space

+ (double)getFreeMemory;              // Free memory
+ (double)getTotalMemory;             // Total memory
+ (double)getUsedMemory;              // Used memory
+ (double)getAvailableMemory;         // Available memory
+ (double)getActiveMemory;            // Active memory (used by running apps)
+ (double)getInActiveMemory;          // Inactive memory (recently used by apps no loger running)
+ (double)getWiredMemory;             // Wired memory (used by OS)
+ (double)getPurgableMemory;          // Puragable memory (can be freed)

+ (BOOL)isRunningIPad;                // Determine if device running iPad.  TRUE - running iPad, FALSE running iPhone, iPod Touch, ...
+ (BOOL)isIPhone;                     // Determine if device is an iPhone
+ (BOOL)isIPhone4;                    // Determine if device running is an iPhone 4
+ (BOOL)doesSupportMultitasking;      // Determine if device supports multitasking. TRUE - yes, FALSE - no
+ (BOOL)isProximitySensorAvailable;   // Determine if proximity sensor is available for the device.   TRUE - yes, FALSE - no

// utility method for loading country codes
+ (void)loadCodes;

+ (NSString *)formatBytes:(int)_number;
+ (NSString *)formatBytes2:(long long)_number;
+ (NSString *)formatBytes3:(u_long)_number;
+ (NSString *)formatDBytes:(double)_number;
+ (NSString *)formatNumber:(int)_number;
+ (NSString *)formatNumber2:(unsigned long long)_number;
+ (NSString *)formatNumber3:(unsigned long)_number;
+ (NSTimeInterval)uptime:(NSNumber **)days hours:(NSNumber **)hours mins:(NSNumber **)mins;

+ (NSString *)broadcastAddressForAddress:(NSString *)ipAddress withMask:(NSString *)netmask;
+ (NSString *)ipAddressForInterface:(NSString *)ifName;
+ (NSString *)ipAddressForWifi;
+ (NSString *)netmaskForInterface:(NSString *)ifName;
+ (NSString *)netmaskForWifi;
Hide

Supported OS and SDK Versions

  • ARC
  • Supported build target - iOS 6.0 / Mac OS 10.7 (Xcode 5.1, Apple LLVM compiler 3.2)
  • Earliest supported deployment target - iOS 6.0 / Mac OS 10.6
  • Earliest compatible deployment target - iOS 6.0 / Mac OS 10.6

NOTE: 'Supported' means that the library has been tested with this version. 'Compatible' means that the library should work on this OS version (i.e. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly.

Hide

Installation

To install SystemUtilities for your app, drag the all the files in the SystemUtilities folder to your app.

Required Frameworks and Libraries

Must include the following frameworks:

  • libresolv.dylib
  • AVFoundation
  • CoreFoundation
  • ExternalAccessory
  • CoreTelephony
  • MediaPlayer
  • Foundation
  • UIKit
  • CoreGraphics
  • CoreLocation
  • MobileCoreServices
  • Security
  • MapKit
  • MessageUI
  • SystemConfiguration
  • QuartzCore.
Hide

Usage

All methods provides are class methods and are called by using [SystemUtilities    getProcessorInfo]; syntax , for example.

To use simply import the SystemUtilities.h file, call whichever methods you want, and find the information. It's that easy!

 // see Demo Example in Examples/Demo folder for full example and source code

 if ([SystemUtilities isRunningIPad])
       NSLog(@"running iPad...");
 else
    NSLog(@"not running iPad (iPhone or iPod Touch)...");

 NSString * ipAddress = [SystemUtilities getIPAddress];
 NSLog(@"IP address: %@", ipAddress);

 NSString * freeDiskSpaceAndPct = [SystemUtilities getFreeDiskSpaceAndPct];
 NSLog(@"free disk space: %@", freeDiskSpaceAndPct);

  NSString * freeMemoryAndPct = [SystemUtilities getFreeMemoryAndPct];
  NSLog(@"free memory: %@", freeMemoryAndPct);

  NSString * carrierInfo = [SystemUtilities getCarrierInfo];
  NSLog(@"carrier information: %@", carrierInfo);

  NSString * processorInfo = [SystemUtilities getProcessorInfo];
  NSLog(@"processor information: %@", processorInfo);

  NSString * uptimeString = [SystemUtilities getSystemUptime];
  NSLog(@"Uptime: %@", uptimeString);

  // Get process information
  NSMutableArray * processInfo = [SystemUtilities getProcessInfo];
  if (processInfo != nil) 
     NSLog(@"There are d processes", [processInfo count]);

  NSString * deviceResolutionString = [SystemUtilities getDeviceResolution:TRUE];
  NSString * screenResolutionString = [SystemUtilities getScreenResolution];
  NSString * mirroringStr = nil;
  BOOL isMirroringSupported = [SystemUtilities isMirroringSupported];

  if (isMirroringSupported)
      mirroringStr = @"mirroring is supported";
  else
    mirroringStr = @"mirroring is not supported";

  NSLog(@"Device Resolution is %@", deviceResolution);
  NSLog(@"Screen Resolution is %@", screenResolution);
  NSLog(@"Mirroring? %@", mirroringStr);

  // New in version 3.2 Text to Speech

  // Fixed Text2Speech with lines > 100 characters with no linefeeds. No breaks into lines at word breaks.
  NSString * _text = @"This is a very, very long line that is more than 100 characters long to test out breaking the line up!";
  [SystemUtilities readText:_text wait:TRUE];

  // New in version 3.0 Text to Speech
  //
  // text to speech demos using English, French and Spanish
  //
  // adding linebreaks causes each to be read as an individual line.
  //

  // English demo
  // English (default is your current locale)
  NSLocale * enLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
  [SystemUtilities setReadTextLocale:enLocale];
  NSLog(@"\n");
  NSLog(@"English locale to use is '%@'", [SystemUtilities getReadingLocaleDescription]);
  NSString * enText = @"Just starting the demo application.\nThis is line 2 I am saying.\nThis is line 3 I am saying.\nBye!";
  [SystemUtilities readText:enText wait:TRUE];


  // Spanish demo
  NSLocale * esLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"es_AR"];
  [SystemUtilities setReadTextLocale:esLocale];
  NSLog(@"\n");
  NSLog(@"Spanish locale to use is '%@'", [SystemUtilities getReadingLocaleDescription]);
  NSString * esText= @"Sólo a partir de la aplicación de demostración.\nEsta es la línea 2 que estoy diciendo.\nSe trata de 3 líneas que estoy diciendo.\nAdios!";
  [SystemUtilities readText:esText wait:TRUE];


  // French demo
  NSLocale * frLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"fr_FR"];
  [SystemUtilities setReadTextLocale:frLocale];
  NSLog(@"\n");
  NSLog(@"French locale to use is '%@'", [SystemUtilities getReadingLocaleDescription]);
  NSString * frText= @"YVous débutez l'application de démonstration.\nCeci est la ligne 2 que je dis.\nCeci est la ligne 3 que je dis.\nAu revoir!";
  [SystemUtilities readText:frText wait:TRUE];


  // demo of acquiring an audio file named audio.mp3 of the specified text

  [SystemUtilities setReadTextLocale:enLocale];
  NSString * audioFilePath = [SystemUtilities getAudioFileForText:@"This is a test of getting the audio file for the specified text." name:@"audio.mp3"];

  if ([SystemUtilities doesFileAtPathExist:audioFilePath]) {
    NSLog(@"audio file returned is %@", audioFilePath);

    [SystemUtilities playAudioFileUsingPath:audioFilePath wait:TRUE];
    [SystemUtilities deleteFileAtPath:audioFilePath];
  } else
    NSLog(@"audio file not returned!");
Hide

Example Project Demo

The demo example in the Examples/Demo folder demonstrates how you might implement using SystemUtilities.

The example is for iOS.

You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

X

Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

3 licenses, starting from From » $29.99 14 day money-back guarantee View Licenses
or Get a quote

for customization or integration services

  • Very helpfull tool that allows me to use many information of the device that otherwise would require much effort! I did tried to implement by myself some of the functionalities and it was more than hard.. It saved my day!
    PK Papadopoulos Konstantinos
    2 years ago, 0 comments
    Was this helpful?
    Flag 2 of 2 people found this review helpful
  • * too old programming.
    * some of API does not work.
    * not ARC (you need to change the code manually).
    AR Ahmad Razoogi
    8 months ago, 0 comments
    Was this helpful?
    Flag 1 of 1 people found this review helpful
  • It works out of the box.
    Simple component, extremely easy to integrate, I just used the methods onWifiNetword and getIpAddressForWifi for now.
    Great list of methods that you will probably use in almost all your apps.
    M m402780@rtrtr.com
    2 years ago, 0 comments
    Was this helpful?
    Flag
Post a comment

Or enter your name and Email
  • Thomas A. Markel Developer 2 months ago
    New version 5.2 - additional support for iPhone 6 Version 5.1: - support for new iPhone 6 and iPhone 6 Plus Version 5.0 features: - ARC - new demo - code cleanup.
  • Thomas A. Markel Developer 3 months ago
    New version 4.2 with methods for determining if a device has Siri or TouchID.
  • Thomas A. Markel Developer 4 months ago
    Version 4.1 adds method to acquire DNS Servers information. Version 4.0 added support for all the iOS devices.