美文网首页
IOS 硬件信息的获取

IOS 硬件信息的获取

作者: 越天高 | 来源:发表于2020-06-06 23:08 被阅读0次

硬件信息获取简介

  • 功能

1.设备的型号
2.设备的CPU型号\使用情况
3.设备的内存容量\使用情况
4.设备的硬盘容量\使用情况

  • 应用场景

QQ空间APP 发说说时, 出现的什么什么型号的手机;
迅雷APP 下载文件时提示剩余空间,已用空间

  • 实现方案

直接通过第三方工具类(UIDevice的分类), 进行获取对应信息
https://github.com/Shmoopi/iOS-System-Services
原因: 自己写起来比较复杂, 很多C语言的东西, 而且没有必要;

可以使用的信息

// System Information

// Properties

/* All System Information in Dictionary Format */
//所有的信息
NSDictionary *allSystemInformation;

/* Hardware Information */

// System Uptime (dd hh mm)
//系统正常运行时间
NSString *systemsUptime;

// Model of Device
//设备型号
NSString *deviceModel;

// Device Name
//设备名称
NSString *deviceName;

// System Name
NSString *systemName;

// System Version
//系统版本
NSString *systemsVersion;

// System Device Type (Not Formatted = iPhone1,0)
//系统设备类型未格式化
NSString *systemDeviceTypeNotFormatted;

// System Device Type (Formatted = iPhone 1)
系统设备类型格式化
NSString *systemDeviceTypeFormatted;

// Get the Screen Width (X)
//屏幕宽度
NSInteger screenWidth;

// Get the Screen Height (Y)
//屏幕高度
NSInteger screenHeight;

// Get the Screen Brightness
//屏幕亮度
float screenBrightness;

// Multitasking enabled?
//是否多任务
BOOL multitaskingEnabled;

// Proximity sensor enabled?
BOOL proximitySensorEnabled;

// Debugger Attached?
//附件调试
BOOL debuggerAttached;

// Plugged In?
//是否接通电源
BOOL pluggedIn;

// Step-Counting Available?
//计步器可以用?
BOOL stepCountingAvailable;

// Distance Available
//距离是否可以用
BOOL distanceAvailable;

// Floor Counting Available
//楼层数是否可用
BOOL floorCountingAvailable;

/* Jailbreak Check */

// Jailbroken?
int jailbroken;

/* Processor Information */

// Number of processors
NSInteger numberProcessors;

// Number of Active Processors
NSInteger numberActiveProcessors;

// Processor Usage Information
NSArray *processorsUsage;

/* Accessory Information */

// Are any accessories attached?
BOOL accessoriesAttached;

// Are headphone attached?
BOOL headphonesAttached;

// Number of attached accessories
NSInteger numberAttachedAccessories;

// Name of attached accessory/accessories (seperated by , comma's)
NSString *nameAttachedAccessories;

/* Carrier Information */

// Carrier Name
NSString *carrierName;

// Carrier Country
NSString *carrierCountry;

// Carrier Mobile Country Code
NSString *carrierMobileCountryCode;

// Carrier ISO Country Code
NSString *carrierISOCountryCode;

// Carrier Mobile Network Code
NSString *carrierMobileNetworkCode;

// Carrier Allows VOIP
BOOL carrierAllowsVOIP;

/* Battery Information */

// Battery Level
float batteryLevel;

// Charging?
BOOL charging;

// Fully Charged?
BOOL fullyCharged;

/* Network Information */

// Get Current IP Address
NSString *currentIPAddress;

// Get External IP Address
NSString *externalIPAddress;

// Get Cell IP Address
NSString *cellIPAddress;

// Get Cell Netmask Address
NSString *cellNetmaskAddress;

// Get Cell Broadcast Address
NSString *cellBroadcastAddress;

// Get WiFi IP Address
NSString *wiFiIPAddress;

// Get WiFi Netmask Address
NSString *wiFiNetmaskAddress;

// Get WiFi Broadcast Address
NSString *wiFiBroadcastAddress;

// Get WiFi Router Address
NSString *wiFiRouterAddress;

// Connected to WiFi?
BOOL connectedToWiFi;

// Connected to Cellular Network?
BOOL connectedToCellNetwork;

/* Process Information */

// Process ID
int processID;

/* Disk Information */

// Total Disk Space
NSString *diskSpace;

// Total Free Disk Space (Raw)
NSString *freeDiskSpaceinRaw;

// Total Free Disk Space (Percentage)
NSString *freeDiskSpaceinPercent;

// Total Used Disk Space (Raw)
NSString *usedDiskSpaceinRaw;

// Total Used Disk Space (Percentage)
NSString *usedDiskSpaceinPercent;

// Get the total disk space in long format
long long longDiskSpace;

// Get the total free disk space in long format
long long longFreeDiskSpace;

/* Memory Information */

// Total Memory
double totalMemory;

// Free Memory (Raw)
double freeMemoryinRaw;

// Free Memory (Percent)
double freeMemoryinPercent;

// Used Memory (Raw)
double usedMemoryinRaw;

// Used Memory (Percent)
double usedMemoryinPercent;

// Active Memory (Raw)
double activeMemoryinRaw;

// Active Memory (Percent)
double activeMemoryinPercent;

// Inactive Memory (Raw)
double inactiveMemoryinRaw;

// Inactive Memory (Percent)
double inactiveMemoryinPercent;

// Wired Memory (Raw)
double wiredMemoryinRaw;

// Wired Memory (Percent)
double wiredMemoryinPercent;

// Purgable Memory (Raw)
double purgableMemoryinRaw;

// Purgable Memory (Percent)
double purgableMemoryinPercent;

/* Accelerometer Information */

// Device Orientation
UIInterfaceOrientation deviceOrientation;

/* Localization Information */

// Country
NSString *country;

// Language
NSString *language;

// TimeZone
NSString *timeZoneSS;

// Currency Symbol
NSString *currency;

/* Application Information */

// Application Version
NSString *applicationVersion;

// Clipboard Content
NSString *clipboardContent;

// Application CPU Usage
float applicationCPUUsage;

/* Universal Unique Identifiers */

// CFUUID
NSString *cfuuid;

相关文章

网友评论

      本文标题:IOS 硬件信息的获取

      本文链接:https://www.haomeiwen.com/subject/vorvzhtx.html