怎么判断ios 版本

酒鬼 2012-03-15

前几天工程项目要用到判断ios版本,最后研究了一下,分享一下:

-(void)getIOSVersion

{

//#if__IPHONE_OS_VERSION_MAX_ALLOWED>=50000//此方法和编译器相关

//quanju.iOSVersion=1;

//#endif

floatversion=[[[UIDevicecurrentDevice]systemVersion]floatValue];

if(version>=5.0)

{

quanju.iOSVersion=1;//定义全局变量标记ios版本

}

}

-(void)getIOSModel

{

CGSizesizeToRequest;

if([[[UIDevicecurrentDevice]model]rangeOfString:@"iPad"].location==0)

sizeToRequest=CGSizeMake(748,110);

else

sizeToRequest=CGSizeMake(320,48);

}

//下面是ios内其他相关信息的判断方法

获取进程信息和设备信息(包括设备类型,序列号,ios版本等)

[[NSProcessInfoprocessInfo]globallyUniqueString],

[[NSProcessInfoprocessInfo]hostName],

[[NSProcessInfoprocessInfo]operatingSystemName],

[[NSProcessInfoprocessInfo]operatingSystemVersionString],

[[NSProcessInfoprocessInfo]physicalMemory],

[[NSProcessInfoprocessInfo]processName]);

——————————————————————————————

[UIDevicecurrentDevice].uniqueIdentifier,

[UIDevicecurrentDevice].name,

[UIDevicecurrentDevice].systemName,

[UIDevicecurrentDevice].systemVersion,

[UIDevicecurrentDevice].model,

[UIDevicecurrentDevice].localizedModel,

[UIDevicecurrentDevice].batteryLevel

___________________________________________________

NSLog([[UIDevicecurrentDevice]name]);//Nameofthephoneasnamedbyuser

NSLog([[UIDevicecurrentDevice]uniqueIdentifier]);//AGUIDlikestring

NSLog([[UIDevicecurrentDevice]systemName]);//"iPhoneOS"

NSLog([[UIDevicecurrentDevice]systemVersion]);//"2.2.1"

NSLog([[UIDevicecurrentDevice]model]);//"iPhone"onbothdevices

NSLog([[UIDevicecurrentDevice]localizedModel]);//"iPhone"onbothdevices

原文地址:http://blog.csdn.net/jinglijun/article/details/7292674

相关推荐