• Stars
    star
    1,135
  • Rank 39,634 (Top 0.9 %)
  • Language
    Objective-C
  • License
    Apache License 2.0
  • Created about 12 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Detects the hardware, software and display of the current iOS or Mac OS X device at runtime.

GBDeviceInfo logo

Detects the hardware, software and display of the current iOS or Mac OS X device at runtime.

Versionย License

iOS

Simple usage (examples on iPhone 6 running iOS 8.1.3):

[[GBDeviceInfo deviceInfo] isOperatingSystemAtLeastVersion:@"8.0"]; // #> YES

[GBDeviceInfo deviceInfo].isJailbroken;                             // #> NO

[GBDeviceInfo deviceInfo].model;                                    // #> GBDeviceModeliPhone6
[GBDeviceInfo deviceInfo].family;                                   // #> GBDeviceFamilyiPad

[GBDeviceInfo deviceInfo].modelString;                              // #> @"iPhone 6"
[GBDeviceInfo deviceInfo].osVersion.major;                          // #> 8
[GBDeviceInfo deviceInfo].osVersion.minor;                          // #> 1

[GBDeviceInfo deviceInfo].displayInfo.pixelsPerInch;                // #> 326

You can also reuse the returned object to save some typing. First assign the object to some variable:

GBDeviceInfo *deviceInfo = [GBDeviceInfo deviceInfo];

Then get whatever you like from the object:

//Model numbers
NSLog(@"Major device ver: %d", deviceInfo.deviceVersion.major);     // Major device ver: 7
NSLog(@"Major device ver: %d", deviceInfo.deviceVersion.minor);     // Minor device ver: 2


//Specific model
if (deviceInfo.model == GBDeviceModeliPhone6) {
    NSLog(@"It's a 6");                                             // It's a 6
}

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

//Screen type
if (deviceInfo.display == GBDeviceDisplayiPhone4p7Inch) {
    NSLog(@"4.7 Inch display");                                     // 4.7 Inch display
}

//iOS Version
if (deviceInfo.majoriOSVersion >= 6) {
    NSLog(@"We've got iOS 6+");                                     // We've got iOS 6+
}

//Raw systemInfo string
NSLog(@"systemInfo: %@", deviceInfo.rawSystemInfoString);           // systemInfo: iPhone7,2

Don't forget to import header.

#import <GBDeviceInfo/GBDeviceInfo.h>

If you want to use the isJailbroken property, make sure you first add the Jailbreak subspec to your project's Podfile, e.g.:

pod 'GBDeviceInfo', '~> 6.0'
pod 'GBDeviceInfo/Jailbreak', '~> 6.0'

Missing a property you need? Submit a Pull Request or contact [email protected]!

OS X

Simple usage (examples on a Mac Pro with an Ivy Bridge 3770K processor running 10.8.2):

[[GBDeviceInfo deviceInfo] isOperatingSystemAtLeastVersion:@"10.8"]; // #> YES

[GBDeviceInfo deviceInfo].osVersion.major;                           // #> 10
[GBDeviceInfo deviceInfo].osVersion.minor;                           // #> 8
[GBDeviceInfo deviceInfo].family == GBDeviceFamilyMacPro;            // #> YES
[GBDeviceInfo deviceInfo].isMacAppStoreAvailable;                    // #> YES
[GBDeviceInfo deviceInfo].isIAPAvailable;                            // #> YES

You can also reuse the returned object to save some typing. First assign the object to some variable:

GBDeviceInfo *deviceInfo = [GBDeviceInfo deviceInfo];

Then get whatever you like from the object:

GBDeviceInfo *deviceInfo = [GBDeviceInfo deviceInfo];

//OS X Version
if (deviceInfo.osVersion.minor >= 8) {
    NSLog(@"It's OS X 10.8+ (Mountain Lion)");                     // It's OS X 10.8+ (Mountain Lion)
}
if (deviceInfo.osVersion.patch == 2) {
    NSLog(@"Must be running x.x.2");                               // Must be running x.x.2
}

//App Store stuff
if (deviceInfo.isMacAppStoreAvailable) {
    NSLog(@"App store is available.");                             // App store is available
}
if (deviceInfo.isIAPAvailable) {
    NSLog(@"...and so are IAPs");                                  // ...and so are IAPs
}

//Hardware stuff
NSLog(@"SystemInfo: %@", deviceInfo.rawSystemInfoString);          // SystemInfo: MacPro3,1
NSLog(@"Major device ver: %d", deviceInfo.deviceVersion.major);    // Major device ver: 3
NSLog(@"Minor device ver: %d", deviceInfo.deviceVersion.minor);    // Minor device ver: 1
NSLog(@"Node name: %@", deviceInfo.nodeName);                      // Node name: MyMac.local
NSLog(@"RAM: %.3f GB", deviceInfo.physicalMemory);                 // RAM: 16.000 GB
NSLog(@"CPU freq: %.3f GHz", deviceInfo.cpu.frequency);            // CPU freq: 3.500 GHz
NSLog(@"Number of cores: %d", deviceInfo.cpu.numberOfCores);       // Number of cores: 8
NSLog(@"L2 Cache size: %.0f KB", deviceInfo.cpu.l2CacheSize);      // L2 Cache size: 256 KB

//Endianness
if (deviceInfo.byteOrder == GBByteOrderLittleEndian) {
    NSLog(@"Little Endian");                                       // Little Endian
}

//Family of device
if (deviceInfo.family != GBDeviceFamilyMacBookAir) {
    NSLog(@"It's not a Macbook Air");                              // It's not a Macbook Air
}

//Screen resolution
if (deviceInfo.screenResolution.width == 1920 && deviceInfo.screenResolution.height == 1200) {
    NSLog(@"Resolution: 1920x1200");                              // Resolution: 1920x1200
}

Don't forget to import framework:

#import <GBDeviceInfo/GBDeviceInfo.h>

Missing a property you need? Submit a Pull Request or contact [email protected]!

iOS Device support

  • iPhone1
  • iPhone3G
  • iPhone3GS
  • iPhone4
  • iPhone4S
  • iPhone5
  • iPhone5C
  • iPhone5S
  • iPhone6
  • iPhone6Plus
  • iPhone6S
  • iPhone6SPlus
  • iPhone7
  • iPhone7Plus
  • iPhone8
  • iPhone8Plus
  • iPhoneSE
  • iPhoneSE2
  • iPhoneSE3
  • iPhoneX
  • iPhoneXR
  • iPhoneXS
  • iPhoneXSMax
  • iPhone11
  • iPhone11Pro
  • iPhone11ProMax
  • iPhone12Mini
  • iPhone12
  • iPhone12Pro
  • iPhone12ProMax
  • iPhone13Mini
  • iPhone13
  • iPhone13Pro
  • iPhone13ProMax
  • iPhone14
  • iPhone14Plus
  • iPhone14Pro
  • iPhone14ProMax
  • iPad1
  • iPad2
  • iPad3
  • iPad4
  • iPad5
  • iPad6
  • iPad7
  • iPad8
  • iPad9
  • iPad10
  • iPadMini1
  • iPadMini2
  • iPadMini3
  • iPadMini4
  • iPadMini5
  • iPadMini6
  • iPadAir1
  • iPadAir2
  • iPadAir3
  • iPadAir4
  • iPadAir5
  • iPadPro9p7Inch
  • iPadPro10p5Inch
  • iPadPro12p9Inch
  • iPadPro12p9Inch2
  • iPadPro11Inch
  • iPadPro11Inch2
  • iPadPro12p9Inch3
  • iPadPro12p9Inch4
  • iPadPro11Inch3
  • iPadPro12p9Inch5
  • iPadPro11Inch4
  • iPadPro12p9Inch6
  • iPod1
  • iPod2
  • iPod3
  • iPod4
  • iPod5
  • iPod6
  • iPod7
  • iPhone Simulator
  • iPad Simulator

OS X Device family support

  • iMac
  • iMacPro
  • MacMini
  • MacStudio
  • MacPro
  • MacBook
  • MacBookAir
  • MacBookPro
  • Xserve

Author

Luka Mirosevic (@lmirosevic)

Enterprise

Premium support, integration, use-case adaptations and consulting available. Contact [email protected].

Copyright & License

Copyright 2015 Goonbee

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

GBVersionTracking

Track which versions of your iOS or Mac OS X app a user has previously installed, and the whole upgrade cookie crumb trail.
Objective-C
275
star
2

GBPing

Highly accurate ICMP Ping controller for iOS
Objective-C
274
star
3

GBToolbox

Goonbee's iOS development toolbox
Objective-C
29
star
4

angular-stateManager

A simple state manager implementation for Angular.js which enables nested views, the browser back button, proper history, and deep linking.
JavaScript
25
star
5

GBAnalytics

Abstracts away different analytics networks and provides a unified simple interface
Objective-C
22
star
6

GBStorage

Simple iOS and Mac OS X persistence layer with in-memory caching, optional persistence, pre-loading, namespacing and a sweet syntax.
Objective-C
19
star
7

GBCardStack

iOS UI paradigm for a stack of sliding cards. Used in VLC iRemote
Objective-C
17
star
8

GBLaunchCounter

Count how many times your iOS or Mac OS X app has been launched, and optionally register blocks for when a certain number of launches has occurred.
Objective-C
11
star
9

GBJailbreakDetection

iOS jailbreak detection framework for GBDeviceInfo
Ruby
10
star
10

GBHUD

Lightweight HUD (heads up display) for quick transient modals in iOS & OSX apps
Objective-C
9
star
11

GBLaunchAtLogin

Add your app as a login item on Mac OS X
Objective-C
9
star
12

GBPingDemo

Demo project for GBPing
Objective-C
8
star
13

LiveDepot

A library for simple file downloading and inventory management for iOS. Including background transfers, mirrors, thumbnails, proper timeouts, persistent deferred retrying, reachability integration, and an elegant blocks based API. It's NSURLSession for download tasks, on lean steroids.
Objective-C
6
star
14

GBLoading

An elegant, lightweight & most importantly robust asynchronous resource loading library for iOS.
Objective-C
6
star
15

GBStickyViews

Allows you to anchor a view onto another view, even if they're across view hierarchies and coordinate spaces.
Objective-C
5
star
16

GBLocation

Wrapper facade for simplifying the Core Motion APIs and exposing a blocks based interface.
Objective-C
5
star
17

GBFeatureManager

Simple iOS and Mac OS X feature manager for unlocking functionality (e.g. for IAP purchases).
Objective-C
5
star
18

GBMotion

Utility library for helping with motion detection, such as orientation, etc.
Objective-C
4
star
19

GBFancyCamera

A blocks based class for taking pictures from the camera or camera roll, with preview and filters. Supports fully customising the UI as well as custom filters.
Objective-C
3
star
20

GBLittleNotification

Little library for showing in-app popups (e.g. for showing push notifications while the app is open, or notifying the user of transient event). Supports fully customisable animations, styling and interactions.
Objective-C
3
star
21

GBAds

Abstracts away different interstitial ad network implementations and implements simple mediation logic for maximising fill rates
Objective-C
2
star
22

GBRetractableTabBar

iOS Control for a retractable tab bar that supports full customisation in terms of sizing, behaviour, and custom views.
Objective-C
2
star
23

GBCloudBoxClient

GBCloudBox is a framework for over-the-air, asynchronous, in-the-background, resource syncing between iOS or Mac OS X apps and a server.
Objective-C
2
star
24

ReverseGeo

A gem for reverse geocoding lat/lng pairs into a 3 letter ISO country code, fully in-memory with no external service access.
Ruby
2
star
25

JRSwizzle-wrapper

Wrapper project for github.com/rentzsch/jrswizzle.git
Objective-C
1
star
26

GBIAP2

Goonbee's In-App Purchases, simplified. Second Edition.
Objective-C
1
star
27

GBThriftApi

A small library to make thrift a little more palatable in Objective-C on iOS and OS X.
Objective-C
1
star
28

Origin-client

iOS client for the Origin service.
C
1
star
29

GBPush

Objective-C client library for Goonbee's push service for iOS. Use this in your iOS apps to register on channels and handle received push notifications.
Objective-C
1
star
30

Origin-interface

Service interface component for the Origin service.
JavaScript
1
star
31

gb-push-client

Service interface library to Goonbee's simple push service. This is the component which you use to send push notifications to your subscribers.
JavaScript
1
star
32

GBNotificationCenter

A clean & elegant block based API for user notifications that uses Lion's native NSUserNotificationCenter on OS X 10.8+ and falls back to Growl for older versions.
Objective-C
1
star