获取系统相关信息
来源:互联网 发布:优雅的女生知乎 编辑:程序博客网 时间:2024/05/10 15:55
+ (NSString *)getiphoneType;//设备型号
+ (NSString *)getManufacturer;//厂商
+ (NSString *)getUUID;
+ (NSString *)getScreen;//屏幕分辨率
+ (NSString *)getSSID;
+ (NSString *)getBSSID;
+ (NSString *)getCPU;
+ (NSString *)getSystemName;//系统名称
+ (NSString *)getSystemVersion;//系统版本
+ (NSString *)getLanguage;
+ (NSString *)getNetwork;
#import <UIKit/UIKit.h>
#import <sys/utsname.h>
#import <mach-o/arch.h>
#import <SystemConfiguration/CaptiveNetwork.h>
#import "YF_Pay_Reachability.h"
@implementation YF_External_MaHuan_DeviceModel
+ (NSString *)getiphoneType
{
structutsname systemInfo;
uname(&systemInfo);
NSString *platform = [NSStringstringWithCString:systemInfo.machineencoding:NSASCIIStringEncoding];
return platform;
}
+ (NSString *)getManufacturer
{
return@"apple";
}
+ (NSString *)getUUID
{
return [[UIDevicecurrentDevice].identifierForVendorUUIDString];
}
+ (NSString *)getScreen
{
CGRect rect = [[UIScreenmainScreen] bounds];
NSInteger width = (NSInteger)rect.size.width;
NSInteger height = (NSInteger)rect.size.height;
NSInteger scale = (NSInteger)[UIScreenmainScreen].scale;
return [NSStringstringWithFormat:@"%ld*%ld",width*scale,height*scale];
}
+ (NSString *)getSSID
{
NSString *ssid =@"NotFound";
CFArrayRef array =CNCopySupportedInterfaces();
if (array !=nil)
{
CFDictionaryRef dict =CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(array,0));
if (dict !=nil)
{
NSDictionary *dic = (NSDictionary *)CFBridgingRelease(dict);
ssid = [dic valueForKey:@"SSID"];
}
}
return ssid;
}
+ (NSString *)getBSSID
{
NSString *bssid =@"NotFound";
CFArrayRef array =CNCopySupportedInterfaces();
if (array !=nil)
{
CFDictionaryRef dict =CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(array,0));
if (dict !=nil)
{
NSDictionary *dic = (NSDictionary *)CFBridgingRelease(dict);
bssid = [dic valueForKey:@"BSSID"];
}
}
return bssid;
}
+ (NSString *)getCPU
{
constNXArchInfo *info =NXGetLocalArchInfo();
return [NSStringstringWithCString:info->descriptionencoding:kCFStringEncodingUTF8];
}
+ (NSString *)getSystemName
{
return@"iOS";
}
+ (NSString *)getSystemVersion
{
return [[UIDevicecurrentDevice] systemVersion];
}
+ (NSString *)getLanguage
{
NSArray *array = [NSLocalepreferredLanguages];
return [arrayobjectAtIndex:0];
}
+ (NSString *)getNetwork
{
NSString *result=nil;
YF_Pay_Reachability * reachability = [YF_Pay_ReachabilityreachabilityForInternetConnection];
NetworkStatus status = [reachabilitycurrentReachabilityStatus];
switch (status)
{
caseNotReachable:
result = @"No Network";
break;
caseReachableVia4G:
result = @"4G";
break;
caseReachableViaWiFi:
result = @"WiFi";
break;
caseReachableVia3G:
result = @"3G";
break;
caseReachableVia2G:
result = @"2G";
break;
}
return result;
}
- 获取系统相关信息
- 获取系统的相关信息
- 获取系统进程列表及其相关信息
- iOS获取当前系统的相关信息
- C++获取各种系统相关信息
- 获取系统相关信息的方法
- Linux系统内存相关信息获取
- 获取iOS系统的相关信息
- Mysql数据库获取系统相关信息
- shell脚本获取系统相关信息
- JAVA获取系统相关的信息
- android获取系统相关信息(后续更新)
- Android获取系统相关简单信息
- Android获取系统相关的信息
- android获取系统相关信息代码测试
- php获取系统信息的相关方法
- ManagementFactory-JAVA获取系统相关的信息
- C#获取系统相关信息_详细异常信息
- 【BFS】CODE[VS] 1226 倒水问题 (BFS+模拟)
- mysql全局唯一ID生成方案(二)
- WebService里的wsdl的详解以及使用注解修改wsdl的配置
- 玩儿转MVC之大屌牌儿MVC框架(一)
- onAttach(Context) 在Fragment中没有调用
- 获取系统相关信息
- Dubbo之旅--集群容错和负载均衡
- Git常用命令
- 转:DLL导出变量,函数,类
- MFC鼠标动态位置提示框
- win10+TPLINK,用PXE安装redhat系统
- spring jar包的介绍
- 4.IPC 机制(二) IPC基础概念介绍
- mysql给新用授予权限Can't find any matching row in the user table