用 iOS-System-Services 框架获取iOS设备所用的设备信息

用 iOS-System-Services 框架获取iOS设备所用的设备信息

参考资料地址

https://github.com/Shmoopi/iOS-System-Services

百度云盘下载地址

http://pan.baidu.com/s/1c05ot1m

 

This is a singleton class to gather all available information about a device. It gives you over 75 methods to determine everything about a device, including:

  • Hardware & Network Information
  • Battery Usage
  • Accelerometer Data
  • Disk Usage
  • Running Processes
  • Memory Usage
  • And a complete UDID replacement based on unchanging device information.

这是一个单例模式的类,收集了一个设备所有的信息,他提供了75个方法来获取设备的信息

  • 硬件以及网络信息
  • 电池使用情况
  • 处理器信息
  • 磁盘使用信息
  • 运行中的进程
  • 内存使用情况
  • 添加了一个完全的UDID用以替换基于不会改变的设备信息(??)

本人已经过测试,除了一个方法 AudioSessionGetProperty 要被弃用了以外,使用非常方便,可以检测越狱或者不越狱.

 

1.将文件夹 System Services 拖拽至工程项目中

2.引入以下框架

用 iOS-System-Services 框架获取iOS设备所用的设备信息

3.项目工程中引入头文件 SystemServices.h

4.简单例子代码(本人在越狱的iOS7 touch 7.0.4 设备上测试过)

    NSLog(@"===========================================================");
    
    SystemServices *sysInfo = [SystemServices sharedServices];
    
    NSLog(@"%@", sysInfo.allSystemInformation);
    
    NSLog(@"===========================================================");

5.NSLog信息如下

2014-02-27 10:16:59.376 testMyPhone[8877:60b] ===========================================================
2014-02-27 10:17:08.767 testMyPhone[8877:60b] {
    AccessoriesAttached = No;
    "ActiveMemory (Formatted)" = "21.134186";
    "ActiveMemory (Not Formatted)" = "108.207031";
    ApplicationVersion = "1.0";
    BatteryLevel = "100.000000";
    CFUUID = "AC0E443C-C1A3-4B64-B8C9-224726D69A9D";
    CarrierAllowsVOIP = No;
    CarrierCountry = CN;
    CarrierISOCountryCode = Unknown;
    CarrierMobileCountryCode = Unknown;
    CarrierMobileNetworkCode = Unknown;
    CarrierName = Unknown;
    CellBroadcastAddress = Unknown;
    CellIPAddress = Unknown;
    CellMACAddress = Unknown;
    CellNetmaskAddress = Unknown;
    Charging = Yes;
    ClipboardContent = "\U6210\U957f";
    ConnectedToCellNetwork = No;
    ConnectedToWiFi = Yes;
    Country = "zh_CN";
    Currency = "\Uffe5";
    CurrentIPAddress = "192.168.60.104";
    CurrentMACAddress = "02:00:00:00:00:00";
    DebuggerAttached = No;
    DeviceModel = "iPod touch";
    DeviceName = Phoenix;
    DeviceOrientation = 1;
    DeviceSignature = 7568320101100111ZHAS238328512SS;
    DiskSpace = "28.01 GB";
    "External IP Address" = "124.200.223.109";
    "FreeDiskSpace (Formatted)" = "28%";
    "FreeDiskSpace (Not Formatted)" = "7.98 GB";
    "FreeMemory (Formatted)" = "12.732697";
    "FreeMemory (Not Formatted)" = "65.191406";
    FullyCharged = Yes;
    HeadphonesAttached = Yes;
    "InactiveMemory (Formatted)" = "7.167816";
    "InactiveMemory (Not Formatted)" = "36.699219";
    Jailbroken = 3429542;
    Language = "zh-Hans";
    LongDiskSpace = 30076624896;
    LongFreeDiskSpace = 8571482112;
    MultitaskingEnabled = Yes;
    NumberActiveProcessors = 2;
    NumberAttachedAccessories = 0;
    NumberProcessors = 2;
    ParentPID = 8875;
    PluggedIn = Yes;
    ProcessID = 8877;
    ProcessName = testMyPhone;
    ProcessStatus = 2;
    ProcessesInformation =     (
                {
            Flags = 512;
            Name = "kernel_task";
            PID = 0;
            ParentID = "-1";
            Priority = 21;
            StartDate = "2014-02-20 23:45:27 +0000";
            Status = 2;
        },
                {
            Flags = "-2147467264";
            Name = launchd;
            PID = 1;
            ParentID = "-1";
            Priority = 24;
            StartDate = "2014-02-20 23:45:27 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = UserEventAgent;
            PID = 19;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = BTServer;
            PID = 21;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = SpringBoard;
            PID = 26;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = aggregated;
            PID = 27;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = backboardd;
            PID = 32;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16392;
            Name = configd;
            PID = 34;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = "fairplayd.O2";
            PID = 37;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = fseventsd;
            PID = 38;
            ParentID = 1;
            Priority = 50;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = iaptransportd;
            PID = 39;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = identityservices;
            PID = 40;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = imagent;
            PID = 41;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = locationd;
            PID = 42;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = mDNSResponder;
            PID = 44;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = mediaserverd;
            PID = 47;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = lockdownd;
            PID = 54;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = powerd;
            PID = 62;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = sharingd;
            PID = 65;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = syslogd;
            PID = 67;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = wifid;
            PID = 72;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16640;
            Name = baiduimd;
            PID = 75;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-20 23:45:36 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = notifyd;
            PID = 131;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:37 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = distnoted;
            PID = 140;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:38 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = networkd;
            PID = 151;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:39 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = apsd;
            PID = 163;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-20 23:45:42 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = tccd;
            PID = 188;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:45:44 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = touchsetupd;
            PID = 211;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:46:00 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = filecoordination;
            PID = 240;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:46:24 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = calaccessd;
            PID = 257;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-20 23:46:34 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = dataaccessd;
            PID = 423;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-21 00:07:06 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = kbd;
            PID = 542;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-21 02:52:05 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = mediaremoted;
            PID = 594;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-21 03:25:37 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = EscrowSecurityAl;
            PID = 1199;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-21 15:47:13 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = MobileMail;
            PID = 2161;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-22 11:19:28 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = itunesstored;
            PID = 3814;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-23 23:36:45 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = CVMServer;
            PID = 4639;
            ParentID = 1;
            Priority = 40;
            StartDate = "2014-02-24 09:11:07 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = gamed;
            PID = 6872;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-25 13:51:48 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = DuetLST;
            PID = 7039;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-25 14:21:38 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = securityd;
            PID = 7041;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-25 14:21:39 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = "networkd_privile";
            PID = 7051;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-25 14:21:44 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = geod;
            PID = 8440;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:09:21 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = lsd;
            PID = 8450;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:09:33 +0000";

            Status = 2;
        },
                {
            Flags = 16384;
            Name = installd;
            PID = 8452;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:09:33 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = sandboxd;
            PID = 8454;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:10:38 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = itunescloudd;
            PID = 8457;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:10:51 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = CommCenterClassi;
            PID = 8459;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:10:51 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = medialibraryd;
            PID = 8467;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:10:55 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = accountsd;
            PID = 8477;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:11:20 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = aosnotifyd;
            PID = 8489;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:12:39 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = MobileGestaltHel;
            PID = 8496;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:12:41 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = mobileassetd;
            PID = 8506;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:12:50 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = "com.apple.Stream";
            PID = 8514;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:12:59 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = AppleIDAuthAgent;
            PID = 8518;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-26 23:13:07 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = librariand;
            PID = 8522;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:13:08 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = wirelessproxd;
            PID = 8540;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:16:11 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = routined;
            PID = 8546;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:16:57 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = storebookkeeperd;
            PID = 8550;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-26 23:22:10 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = timed;
            PID = 8554;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:24:48 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = adid;
            PID = 8563;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:38:35 +0000";
            Status = 2;
        },
                {
            Flags = 16640;
            Name = xpcd;
            PID = 8580;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:52:10 +0000";
            Status = 2;
        },
                {
            Flags = 16640;
            Name = IMDPersistenceAg;
            PID = 8582;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-26 23:52:11 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = ptpd;
            PID = 8623;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-27 00:39:14 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = afcd;
            PID = 8625;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-27 00:39:14 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = "mobile_installat";
            PID = 8631;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-27 00:39:15 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = "notification_pro";
            PID = 8633;
            ParentID = 1;
            Priority = 40;
            StartDate = "2014-02-27 00:39:15 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = "syslog_relay";
            PID = 8637;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-27 00:39:15 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = XcodeDeviceMonit;
            PID = 8639;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-27 00:39:15 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = ubd;
            PID = 8643;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-27 00:39:16 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = voiced;
            PID = 8664;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-27 00:53:37 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = SystemServicesDe;
            PID = 8862;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-27 02:14:43 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = syncdefaultsd;
            PID = 8871;
            ParentID = 1;
            Priority = 32;
            StartDate = "2014-02-27 02:16:43 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = debugserver;
            PID = 8875;
            ParentID = 1;
            Priority = 24;
            StartDate = "2014-02-27 02:16:44 +0000";
            Status = 2;
        },
                {
            Flags = 18432;
            Name = testMyPhone;
            PID = 8877;
            ParentID = 8875;
            Priority = 24;
            StartDate = "2014-02-27 02:16:44 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = assistantd;
            PID = 8878;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-27 02:16:54 +0000";
            Status = 2;
        },
                {
            Flags = 16384;
            Name = "assistant_servic";
            PID = 8882;
            ParentID = 1;
            Priority = 17;
            StartDate = "2014-02-27 02:16:56 +0000";
            Status = 2;
        }
    );
    ProcessorBusSpeed = 995;
    ProcessorSpeed = 1026;
    ProximitySensorEnabled = No;
    "PurgableMemory (Formatted)" = "2.330780";
    "PurgableMemory (Not Formatted)" = "11.933594";
    ScreenBrightness = "74.338623";
    ScreenHeight = 568;
    ScreenWidth = 320;
    SystemDeviceType = "iPod5,1";
    "SystemDeviceType Formatted" = Unknown;
    SystemName = "iPhone OS";
    SystemVersion = "7.0.4";
    TimeZone = "Asia/Shanghai";
    TotalMemory = "512.000000";
    UniqueID = 6HH135102210002S;
    "Uptime (dd hh mm)" = "3 18 35";
    "UsedDiskSpace (Formatted)" = "71%";
    "UsedDiskSpace (Not Formatted)" = "20.03 GB";
    "UsedMemory (Formatted)" = "44.140625";
    "UsedMemory (Not Formatted)" = "226.660156";
    WiFiBroadcastAddress = "192.168.60.255";
    WiFiIPAddress = "192.168.60.104";
    WiFiMACAddress = "02:00:00:00:00:00";
    WiFiNetmaskAddress = "255.255.255.0";
    "WiredMemory (Formatted)" = "15.967560";
    "WiredMemory (Not Formatted)" = "81.753906";
}
2014-02-27 10:17:08.809 testMyPhone[8877:60b] ===========================================================

 

上一篇:什么是雪花ID?


下一篇:使用fiddler抓取手机上的HTTPS包