MBDevice Class Reference

Inherits from NSObject
Conforms to MBSingleton
Declared in MBDevice.h

Overview

The MBDevice singleton provides information about the device and operating environment of the running application.

The MBDevice singleton is available by default as the Mockingbird variable $Device.

Warning: You must not create instances of this class yourself; this class is a singleton. Call the instance class method (declared by the MBSingleton protocol) to acquire the singleton instance.

Device information

  isSimulator

Returns YES when running in the iOS Simulator environment; NO when running on the device.

@property (nonatomic, readonly) BOOL isSimulator

Declared In

MBDevice.h

  isIPhone

Returns YES when running in an iPhone environment.

@property (nonatomic, readonly) BOOL isIPhone

Declared In

MBDevice.h

  isIPad

Returns YES when running in an iPad environment.

@property (nonatomic, readonly) BOOL isIPad

Declared In

MBDevice.h

Operating system information

  osType

Returns a human-readable string indicating the operating system type, eg. “iPhone OS”.

@property (nonnull, nonatomic, readonly) NSString *osType

Declared In

MBDevice.h

  osVersion

Returns the operating system version string, eg. “8.1.3

@property (nonnull, nonatomic, readonly) NSString *osVersion

Declared In

MBDevice.h

  osVersionComponents

Returns the individual components of the operating system version as an array of NSNumbers, eg. [8, 1, 3].

@property (nonnull, nonatomic, readonly) NSArray *osVersionComponents

Declared In

MBDevice.h

  osVersionMajor

Returns the major component of the operating system version, eg. the 8 in “8.1.3”.

@property (nonnull, nonatomic, readonly) NSNumber *osVersionMajor

Declared In

MBDevice.h

  osVersionMinor

Returns the minor component of the operating system version, eg. the 1 in “8.1.3”.

@property (nonnull, nonatomic, readonly) NSNumber *osVersionMinor

Declared In

MBDevice.h

  osVersionRevision

Returns the revision component of the operating system version, eg. the 3 in “8.1.3”.

@property (nonnull, nonatomic, readonly) NSNumber *osVersionRevision

Declared In

MBDevice.h

Application state information

  appIsInBackground

Returns YES if the application is currently in the background.

@property (nonatomic, readonly) BOOL appIsInBackground

Declared In

MBDevice.h

  currentOrientation

Returns the string “portrait” or “landscape” depending on the current orientation of the device.

@property (nonnull, nonatomic, readonly) NSString *currentOrientation

Declared In

MBDevice.h

  isPortrait

Returns YES if the device is currently in portrait orientation.

@property (nonatomic, readonly) BOOL isPortrait

Declared In

MBDevice.h

  isLandscape

Returns YES if the device is currently in landscape orientation.

@property (nonatomic, readonly) BOOL isLandscape

Declared In

MBDevice.h

Screen resolution information

  screenScale

Returns the scale of the main UIScreen.

@property (nonnull, nonatomic, readonly) NSNumber *screenScale

Declared In

MBDevice.h

  isRetina

Returns YES if the main UIScreen’s scale is 2.0 or greater.

@property (nonatomic, readonly) BOOL isRetina

Declared In

MBDevice.h

  screenWidth

Returns the width of the main UIScreen in the current orientation.

@property (nonnull, nonatomic, readonly) NSNumber *screenWidth

Declared In

MBDevice.h

  screenHeight

Returns the height of the main UIScreen in the current orientation.

@property (nonnull, nonatomic, readonly) NSNumber *screenHeight

Declared In

MBDevice.h

  screenSize

Returns a comma-separated string containing the width and height of the screen in the current orientation as “width,height”.

@property (nonnull, nonatomic, readonly) NSString *screenSize

Declared In

MBDevice.h

  screenSizePortrait

Returns a comma-separated string containing the width and height of the screen when the device is in portrait orientation.

@property (nonnull, nonatomic, readonly) NSString *screenSizePortrait

Declared In

MBDevice.h

  screenSizeLandscape

Returns a comma-separated string containing the width and height of the screen when the device is in landscape orientation.

@property (nonnull, nonatomic, readonly) NSString *screenSizeLandscape

Declared In

MBDevice.h