UDID
UDID (Unique Device Identifier) :設(shè)備唯一標(biāo)識(shí)符
UDID是一個(gè)40位十六進(jìn)制序列,1326ee2662389aa5424e72875bf99211
獲取方法:
[UIDevice currentDevice] uniqueIdentifier]
iOS5之后失效,現(xiàn)在可以使用iTunes和Xcode來獲取這個(gè)值
UUID
UUID (Universally Unique Identifier):通用唯一標(biāo)識(shí)符,當(dāng)前這一刻全世界唯一,每次生成都是一個(gè)不一樣的值
UUID是一個(gè)32位的十六進(jìn)制序列(8-4-4-4-12), 37B326DB-0D51-4EC9-A93D-8A3AB37C411E
獲取方法:
NSString *uuid = [NSUUID UUID].UUIDString;
iOS6之后可以使用
IDFA
IDFA (Identifier For Advertising):廣告標(biāo)識(shí)符,設(shè)備唯一,可以用來不同App之間共享數(shù)據(jù)
IDFA是一個(gè)32位的十六進(jìn)制序列(8-4-4-4-12), 372BED65-EC7E-4F4F-B70B-5C5430078AEB
獲取方法:
ASIdentifierManager *asIM = [[ASIdentifierManager alloc] init];
NSString *idfa = [asIM.advertisingIdentifier UUIDString];
iOS6之后可以使用,如果用戶將限制廣告跟蹤的開關(guān)打開,返回00000000-0000-0000-000000000000,再次關(guān)閉會(huì)重新生成一個(gè),還原也會(huì)重新生成
審核注意事項(xiàng):https://blog.csdn.net/qq_29284809/article/details/52053833
IDFV
IDFV (Identifier For Vendor ):開發(fā)商標(biāo)識(shí)符,和Bundle Identifier綁定,同一前綴的id下的應(yīng)用獲取的值相同,可以用來相同開發(fā)商下不同App之間共享數(shù)據(jù)
IDFV是一個(gè)32位的十六進(jìn)制序列(8-4-4-4-12), 896A7040-F380-4885-A093-D8892C54F5F1
獲取方法:
[[UIDevice currentDevice] identifierForVendor].UUIDString;
iOS6之后可以使用
IMEI
IMEI (International Mobile Equipment Identity):國際移動(dòng)設(shè)備識(shí)別碼,由15位數(shù)字組成的”電子串號(hào)”,它與每臺(tái)手機(jī)一一對(duì)應(yīng),而且該碼是全世界唯一的。每一部手機(jī)在組裝完成后都將被賦予一個(gè)全球唯一的一組號(hào)碼,這個(gè)號(hào)碼從生產(chǎn)到交付使用都將被制造生產(chǎn)的廠商所記錄。手機(jī)用戶可以在手機(jī)中查到自己手機(jī)的IMEI碼。
iOS5可以使用,之后失效
IMSI
IMSI (International Mobile Subscriber Identification Number):國際移動(dòng)用戶識(shí)別碼
IMSI分為兩部分:
一部分叫MCC(Mobile Country Code 移動(dòng)國家碼),MCC的資源由國際電聯(lián)(ITU)統(tǒng)一分配,唯一識(shí)別移動(dòng)用戶所屬的國家,MCC共3位,中國地區(qū)的MCC為460
另一部分叫MNC(Mobile Network Code 移動(dòng)網(wǎng)絡(luò)號(hào)碼),用于識(shí)別移動(dòng)客戶所屬的移動(dòng)網(wǎng)絡(luò)運(yùn)營商。MNC由二到三個(gè)十進(jìn)制數(shù)組成,例如中國移動(dòng)MNC為00、02、07,中國聯(lián)通的MNC為01、06、09,中國電信的MNC為03、05、11
CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [info subscriberCellularProvider];
NSString *mcc = [carrier mobileCountryCode];
NSString *mnc = [carrier mobileNetworkCode];
NSString *imsi = [NSString stringWithFormat:@"%@%@", mcc, mnc];
iOS4以后可以使用
MAC地址
應(yīng)用在iOS6及以下時(shí),可以正確取道Mac地址,在iOS7上,會(huì)返回固定值
02:00:00:00:00:00
IP地址
NSString *address = @"";
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
success = getifaddrs(&interfaces);
if (success == 0) { // 0 表示獲取成功
temp_addr = interfaces;
while (temp_addr != NULL) {
if( temp_addr->ifa_addr->sa_family == AF_INET) {
// Check if interface is en0 which is the wifi connection on the iPhone
if ([[NSString [stringWithUTF8String:temp_addr-](http://stringwithutf8stringtemp_addr-/)>ifa_name] isEqualToString:@"en0"]) {
// Get NSString from C String
address = [NSString [stringWithUTF8String:inet_ntoa](http://stringwithutf8stringinet_ntoa/)(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];
}
}
temp_addr = temp_addr->ifa_next;
}
}
freeifaddrs(interfaces);
NSLog(@"%@", address);
注:感謝我的同事坤的分享~