Latest 0.0.5
Homepage https://github.com/gonghonglou/GHLDeviceIdentifier
License MIT
Platforms ios 8.0, requires ARC
Authors

iOS设备机型识别

Packagist
CocoaPods
Travis
Build Status

Demo

请查看 Example/GHLDeviceIdentifier.xcodeproj 目录下示例工程

使用方法

1、判断当前设备机型:

// 方法1:
BOOL isIPhoneXSMax = [GHLDeviceIdentifier ghl_isIPhoneXSMax];
if (isIPhoneXSMax) {
   NSLog(@"---This machine is iPhoneXsMax");
} else {
   NSLog(@"---This machine is not iPhoneXsMax");
}
// NSLog:---This machine is not iPhoneXsMax

// 方法2:
if (GHL_ISIPHONEX) {
   NSLog(@"---This machine is iPhoneX");
} else {
   NSLog(@"---This machine is not iPhoneX");
}
// NSLog:---This machine is iPhoneX

2、输出当前设备机型:

NSString *machineString = [GHLDeviceIdentifier ghl_currentMachineModel];
NSLog(@"---currentMachineModel:%@", machineString);
// NSLog:---currentMachineModel:iPhoneX

3、判断当前设备机型是否是 iPhoneX or iPhoneXS or iPhoneXR or iPhoneXS Max:

if (GHL_ISIPHONEXX) {
   NSLog(@"---This machine is iPhoneX or iPhoneXS or iPhoneXR or iPhoneXS Max");
} else {
   NSLog(@"---This machine is neither iPhoneX nor iPhoneXS nor iPhoneXR nor iPhoneXSMax");
}
// NSLog:---This machine is iPhoneX or iPhoneXS or iPhoneXR or iPhoneXS Max

安装

CocoaPods

  1. 添加 pod 'GHLDeviceIdentifier' 命令到你的 Podfile 文件。
  2. 执行 pod install 方法,或者 pod update 方法。
  3. 引用 <GHLDeviceIdentifier/GHLDeviceIdentifier.h> 头文件。

手动安装

  1. 下载 GHLDeviceIdentifier 目录下的所有文件。
  2. 添加这些源文件到你的工程里。
  3. 引用 GHLDeviceIdentifier.h 头文件。

License

GHLDeviceIdentifier is provided under the MIT license. See LICENSE file for details.

Latest podspec

{
    "name": "GHLDeviceIdentifier",
    "summary": "ios device identifier.",
    "version": "0.0.5",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "gonghonglou": "[email protected]"
    },
    "social_media_url": "http://gonghonglou.com",
    "homepage": "https://github.com/gonghonglou/GHLDeviceIdentifier",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/gonghonglou/GHLDeviceIdentifier.git",
        "tag": "0.0.5"
    },
    "requires_arc": true,
    "source_files": "GHLDeviceIdentifier/*.{h,m}",
    "public_header_files": "GHLDeviceIdentifier/*.{h}"
}

Pin It on Pinterest

Share This