獲取iOS設備的相關信息

NSString *ssid = @"Not Found";

NSString *macIp = @"Not Found";

// ? ?BA5DC546-E961-44B0-85FA-D5CD4C39BF57

// ? 4B9E7471-EF79-4EF5-AEA8-C700CC6D7039

CFUUIDRef puuid = CFUUIDCreate( nil );

CFStringRef uuidString = CFUUIDCreateString( nil, puuid );

NSString * result = (NSString *)CFBridgingRelease(CFStringCreateCopy( NULL, uuidString));

NSLog(@"%@",result);

// ? ?And to use it

CLBeaconRegion *_myBeaconRegion;

NSDictionary *myBeaconData = [_myBeaconRegion peripheralDataWithMeasuredPower:nil];

NSLog(@"%@",myBeaconData);

NSString *identifierForVendor = [[UIDevice currentDevice].identifierForVendor UUIDString];

// ? ?NSString *identifierForAdvertising = [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString];

//設備相關信息的獲取

NSLog(@"%@",identifierForVendor);

NSString *strName = [[UIDevice currentDevice] name];

NSLog(@"設備名稱:%@", strName);//e.g. "My iPhone"

NSString *strId = [[UIDevice currentDevice] identifierForVendor];

NSLog(@"設備唯一標識:%@", strId);//UUID,5.0后不可用

NSString *strSysName = [[UIDevice currentDevice] systemName];

NSLog(@"系統名稱:%@", strSysName);// e.g. @"iOS"

NSString *strSysVersion = [[UIDevice currentDevice] systemVersion];

NSLog(@"系統版本號:%@", strSysVersion);// e.g. @"4.0"

NSString *strModel = [[UIDevice currentDevice] model];

NSLog(@"設備模式:%@", strModel);// e.g. @"iPhone", @"iPod touch"

NSString *strLocModel = [[UIDevice currentDevice] localizedModel];

NSLog(@"本地設備模式:%@", strLocModel);// localized version of model

CFArrayRef myArray = CNCopySupportedInterfaces();

NSLog(@"%@",myArray);

// ? ?80:89:17:31:4b:52

// ? ?94:b4:f:6f:65:80

if (myArray != nil) {

CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));

if (myDict != nil) {

NSDictionary *dict = (NSDictionary*)CFBridgingRelease(myDict);

NSLog(@"%@",dict);

ssid = [dict valueForKey:@"SSID"];

macIp = [dict valueForKey:@"BSSID"];

NSDictionary *ssidData = [dict valueForKey:@"SSIDDATA"];

NSLog(@"......%d",ssidData.count);

}

}

NSLog(@"ssid>>>%@,macIp---->>%@",ssid,macIp);

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容