天天看点

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

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

参考资料地址

<a href="https://github.com/shmoopi/ios-system-services" target="_parent">https://github.com/shmoopi/ios-system-services</a>

百度云盘下载地址

<a href="http://pan.baidu.com/s/1c05ot1m" target="_blank">http://pan.baidu.com/s/1c05ot1m</a>

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 &amp; 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);

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;

            priority = 24;

            flags = 16384;

            name = usereventagent;

            pid = 19;

            parentid = 1;

            priority = 17;

            startdate = "2014-02-20 23:45:36 +0000";

            name = btserver;

            pid = 21;

            name = springboard;

            pid = 26;

            name = aggregated;

            pid = 27;

            name = backboardd;

            pid = 32;

            flags = 16392;

            name = configd;

            pid = 34;

            name = "fairplayd.o2";

            pid = 37;

            name = fseventsd;

            pid = 38;

            priority = 50;

            name = iaptransportd;

            pid = 39;

            name = identityservices;

            pid = 40;

            name = imagent;

            pid = 41;

            name = locationd;

            pid = 42;

            name = mdnsresponder;

            pid = 44;

            name = mediaserverd;

            pid = 47;

            name = lockdownd;

            pid = 54;

            name = powerd;

            pid = 62;

            name = sharingd;

            pid = 65;

            name = syslogd;

            pid = 67;

            name = wifid;

            pid = 72;

            flags = 16640;

            name = baiduimd;

            pid = 75;

            name = notifyd;

            pid = 131;

            startdate = "2014-02-20 23:45:37 +0000";

            name = distnoted;

            pid = 140;

            startdate = "2014-02-20 23:45:38 +0000";

            name = networkd;

            pid = 151;

            startdate = "2014-02-20 23:45:39 +0000";

            name = apsd;

            pid = 163;

            startdate = "2014-02-20 23:45:42 +0000";

            name = tccd;

            pid = 188;

            startdate = "2014-02-20 23:45:44 +0000";

            name = touchsetupd;

            pid = 211;

            startdate = "2014-02-20 23:46:00 +0000";

            name = filecoordination;

            pid = 240;

            startdate = "2014-02-20 23:46:24 +0000";

            name = calaccessd;

            pid = 257;

            startdate = "2014-02-20 23:46:34 +0000";

            name = dataaccessd;

            pid = 423;

            startdate = "2014-02-21 00:07:06 +0000";

            name = kbd;

            pid = 542;

            startdate = "2014-02-21 02:52:05 +0000";

            name = mediaremoted;

            pid = 594;

            startdate = "2014-02-21 03:25:37 +0000";

            name = escrowsecurityal;

            pid = 1199;

            startdate = "2014-02-21 15:47:13 +0000";

            name = mobilemail;

            pid = 2161;

            startdate = "2014-02-22 11:19:28 +0000";

            name = itunesstored;

            pid = 3814;

            startdate = "2014-02-23 23:36:45 +0000";

            name = cvmserver;

            pid = 4639;

            priority = 40;

            startdate = "2014-02-24 09:11:07 +0000";

            name = gamed;

            pid = 6872;

            startdate = "2014-02-25 13:51:48 +0000";

            name = duetlst;

            pid = 7039;

            startdate = "2014-02-25 14:21:38 +0000";

            name = securityd;

            pid = 7041;

            startdate = "2014-02-25 14:21:39 +0000";

            name = "networkd_privile";

            pid = 7051;

            startdate = "2014-02-25 14:21:44 +0000";

            name = geod;

            pid = 8440;

            startdate = "2014-02-26 23:09:21 +0000";

            name = lsd;

            pid = 8450;

            startdate = "2014-02-26 23:09:33 +0000";

            name = installd;

            pid = 8452;

            name = sandboxd;

            pid = 8454;

            startdate = "2014-02-26 23:10:38 +0000";

            name = itunescloudd;

            pid = 8457;

            startdate = "2014-02-26 23:10:51 +0000";

            name = commcenterclassi;

            pid = 8459;

            name = medialibraryd;

            pid = 8467;

            startdate = "2014-02-26 23:10:55 +0000";

            name = accountsd;

            pid = 8477;

            startdate = "2014-02-26 23:11:20 +0000";

            name = aosnotifyd;

            pid = 8489;

            startdate = "2014-02-26 23:12:39 +0000";

            name = mobilegestalthel;

            pid = 8496;

            startdate = "2014-02-26 23:12:41 +0000";

            name = mobileassetd;

            pid = 8506;

            startdate = "2014-02-26 23:12:50 +0000";

            name = "com.apple.stream";

            pid = 8514;

            startdate = "2014-02-26 23:12:59 +0000";

            name = appleidauthagent;

            pid = 8518;

            startdate = "2014-02-26 23:13:07 +0000";

            name = librariand;

            pid = 8522;

            startdate = "2014-02-26 23:13:08 +0000";

            name = wirelessproxd;

            pid = 8540;

            startdate = "2014-02-26 23:16:11 +0000";

            name = routined;

            pid = 8546;

            startdate = "2014-02-26 23:16:57 +0000";

            name = storebookkeeperd;

            pid = 8550;

            startdate = "2014-02-26 23:22:10 +0000";

            name = timed;

            pid = 8554;

            startdate = "2014-02-26 23:24:48 +0000";

            name = adid;

            pid = 8563;

            startdate = "2014-02-26 23:38:35 +0000";

            name = xpcd;

            pid = 8580;

            startdate = "2014-02-26 23:52:10 +0000";

            name = imdpersistenceag;

            pid = 8582;

            startdate = "2014-02-26 23:52:11 +0000";

            name = ptpd;

            pid = 8623;

            startdate = "2014-02-27 00:39:14 +0000";

            name = afcd;

            pid = 8625;

            name = "mobile_installat";

            pid = 8631;

            startdate = "2014-02-27 00:39:15 +0000";

            name = "notification_pro";

            pid = 8633;

            name = "syslog_relay";

            pid = 8637;

            name = xcodedevicemonit;

            pid = 8639;

            name = ubd;

            pid = 8643;

            startdate = "2014-02-27 00:39:16 +0000";

            name = voiced;

            pid = 8664;

            startdate = "2014-02-27 00:53:37 +0000";

            name = systemservicesde;

            pid = 8862;

            startdate = "2014-02-27 02:14:43 +0000";

            name = syncdefaultsd;

            pid = 8871;

            priority = 32;

            startdate = "2014-02-27 02:16:43 +0000";

            name = debugserver;

            pid = 8875;

            startdate = "2014-02-27 02:16:44 +0000";

            flags = 18432;

            name = testmyphone;

            pid = 8877;

            parentid = 8875;

            name = assistantd;

            pid = 8878;

            startdate = "2014-02-27 02:16:54 +0000";

            name = "assistant_servic";

            pid = 8882;

            startdate = "2014-02-27 02:16:56 +0000";

        }

    );

    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] ===========================================================