DDVersion 是一个简单通用的 Objective-C iOS 库,可用于快速获取移动设备型号和名称。
虽然 DDVersion 受到 sebyddd 的 SDiPhoneVersion 的启发,但它不包括对设备尺寸或枚举的支持。至少目前还没有。
此库支持所有 iOS 设备,包括新旧设备。
DDVersion 是 DD-projects 的一部分(查看它们,它们很酷!)
更多 DD-projects 正在开发中,一旦完成就会添加。
// Get the device type as a string (eg. "iPhone6,1" or "i386")
[DDVersion deviceType];
// Get the device name as a string (eg. "iPhone 5S (GSM)" or "Simulator")
[DDVersion deviceName];
要运行示例项目,只需打开 DDVersionDemo.xcodeproj
并点击构建和运行。
DDVersion 通过 CocoaPods 提供。要安装
它,只需将以下行添加到您的 Podfile 中
pod "DDVersion"
只需将 DDVersion.h
和 DDVersion.m
复制到您的项目中,并像这样导入 DDversion.h
#import "DDVersion.h"
与手动安装相比,建议使用 CocoaPod 安装方法,因为这样您的 DDVersion 复制始终是最新的。
Pauli 'Dids' Jokela,[email protected] 和 Didstopia,http://didstopia.com
部分原始代码(以及主要灵感!)源自 sebyddd 的 SDiPhoneVersion。
DDVersion 可在 MIT 许可证下获得。有关更多信息,请参阅 LICENSE 文件。