iOS 獲取蘋果裝置資訊

2021-06-28 23:34:18 字數 2317 閱讀 5092

1.獲取手機可用容量

- (float)freediskspace
2.獲得手機總容量

- (float)gettotaldiskspace  else 

return

0;}

3.手機型號

struct  utsname ;
首先#import 「sys/utsname.h」

struct utsname systeminfo;

uname(&systeminfo);

nsstring * system = [nsstring stringwithcstring:systeminfo.sysname encoding:nsutf8stringencoding];//值為:zhidarwin

nsstring * nodename = [nsstring stringwithcstring:systeminfo.nodename encoding:nsutf8stringencoding];//值為:裝置的名字

nsstring * release = [nsstring stringwithcstring:systeminfo.release encoding:nsutf8stringencoding];//值為:darwin kernel version 14.0.0: mon nov 3 22:24:40 pst 2014; root:xnu-2783.3.22~1/release_arm_s5l8955x

nsstring * version = [nsstring stringwithcstring:systeminfo.version encoding:nsutf8stringencoding];//值為:14.0.0

nsstring * machine = [nsstring stringwithcstring:systeminfo.machine encoding:nsutf8stringencoding];//值為:ipad3,4

4.是否連線wifi或無線廣域網wwan

/*首先加入systemconfiguration.framework

#import "reachability.h"

typedef enum : nsinteger networkstatus;

*/- (networkstatus)getnetworkreachabilitystatus

5.獲得手機網路運營商

//加入cortelephony.framework

//#import

//#import

- (nsstring *)checkcarrier

//獲取流動網路碼

nsstring *code = [carrier mobilenetworkcode];

if ([code isequal:@""])

if ([code isequaltostring:@"00"] || [code isequaltostring:@"02"] || [code isequaltostring:@"07"])

if ([code isequaltostring:@"01"] || [code isequaltostring:@"06"])

if ([code isequaltostring:@"03"] || [code isequaltostring:@"05"])

nslog(@"ret=%@", ret);

return ret;

}

小知識:

imsi是國際移動使用者識別碼的簡稱(international mobile subscriber identity)

imsi共有15位,其結構如下:

mcc+mnc+min

mcc:mobile country code,移動國家碼,共3位,中國為460;

mnc:mobile networkcode,流動網路碼,共2位

在中國,移動的**為電00,02,07;聯通的**為01,06;電信的**為03 ,05; 鐵通**為20.

詳細檢視移動裝置網路碼:

合起來就是(也是android手機中apn配置檔案中的**):

中國移動:46000 46002

中國聯通:46001

中國電信:46003

舉例,乙個典型的imsi號碼為460030912121001

參考:

獲取android手機資訊:

resource from:

獲取iOS裝置資訊

鑌哥就直接寫 了 獲取手機資訊 應用程式的名稱和版本號等資訊都儲存在mainbundle的乙個字典中,用下面 可以取出來 nsdictionary infodict nsbundle mainbundle infodictionary nsstring versionnum infodict obj...

iOS 獲取裝置資訊

ios 獲取裝置資訊 獲取裝置資訊,不囉嗦,直接上 uidevice idfa add adsupport.framework define kdeviceidfa asidentifiermanager sharedmanager advertisingidentifier uuidstring ...

ios獲取裝置資訊

我們寫專案的時候有時候可能會需要獲取到使用者的裝置資訊 下面用 簡要描述一下 uidevice currentdevice uidevice currentdevice nsstring strname currentdevice.name 裝置名稱 nsstring strmodel curren...