Skip to content

Detect underlying hardware of iOS device programatically

Notifications You must be signed in to change notification settings

xpg/GBDeviceInfo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

GBDeviceInfo

Detects the hardware of the current iOS device.

Usage

First get a struct with the hardware info.

GBDeviceDetails deviceDetails = [GBDeviceInfo deviceDetails];

To get the model numbers. e.g. when running on an iPhone 4S

//Model numbers
NSLog(@"Big model number: %d", deviceDetails.bigModel);                 //Big model number: 4
NSLog(@"Small model number: %d", deviceDetails.smallModel);             //Small model number: 1

//Specific model
if (deviceDetails.model == GBDeviceModeliPhone4S) {
    NSLog(@"It's a 4S");                                                //It's a 4S
}

//Family of device
if (deviceDetails.family != GBDeviceFamilyiPad) {
    NSLog(@"It's not an iPad");                                         //It's not an iPad
}

//Screen type
if (deviceDetails.display == GBDeviceDisplayiPhone35Inch) {
	NSLog(@"It has an iPhone 3.5 inch display");						//It has an iPhone 3.5 inch display
}

//Raw systemInfo string
NSLog(@"systemInfo string: %@", [GBDeviceInfo rawSystemInfoString]);    //systemInfo string: iPhone4,1

Don't forget to import header;

#import "GBDeviceInfo.h"

Device support

  • iPhone
  • iPhone3G
  • iPhone3GS
  • iPhone4
  • iPhone4S
  • iPhone5
  • iPad
  • iPad2
  • iPad3
  • iPod
  • iPod2
  • iPod3
  • iPod4
  • iPod5

About

Detect underlying hardware of iOS device programatically

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%