iOS-iPhone系统版本号-iPhone App版本号

转载: http://blog.sina.com.cn/s/blog_7b9d64af0101bu9j.html

很多时候,我们需要获得用户iPhone版本号,或者App的当前版本号。
关心以下两个方面:
一、App项目中,应用程序逻辑会根据iPhone硬件的版本号来进行相应的处理!
二、由于某种需求,我们需要得到我们App的当前版本。
 
一、获得客户端用户的硬件版本号
 

// 判断设备的iOS 版本号

    float version = [[[UIDevice currentDevice] systemVersion] floatValue];

    NSLog(@"%f",version);

 

 

二、我们还可以获得更多相应的设备信息

 

 

 NSLog(@"%@",[[UIDevice currentDevice] name]); // Name of the phone as named by user

    NSLog(@"%@",[[UIDevice currentDevice] uniqueIdentifier]); // A GUID like string 

    NSLog(@"%@",[[UIDevice currentDevice] identifierForVendor]); // A GUID like string(iOS 6.0)

    NSLog(@"%@",[[UIDevice currentDevice] systemName]); // "iPhone OS"

    NSLog(@"%@",[[UIDevice currentDevice] systemVersion]); // "5.1.1"

    NSLog(@"%@",[[UIDevice currentDevice] model]); // "iPhone" on both devices

    NSLog(@"%@",[[UIDevice currentDevice] localizedModel]); // "iPhone" on both devices

 

三、获得App的版本号

 

 

// 获得软件的版本号,

    NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];

    float softVerson =[[infoDict objectForKey:@"CFBundleShortVersionString"] floatValue];

 

读取 Info.plist文件的信息。

 NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];

posted @ 2014-11-17 11:04  爱生活爱代码  阅读(528)  评论(0编辑  收藏  举报