IOS开发之──获得设备类型和系统版本号

IOS开发之──获得设备类型和系统版本号,第1张

概述在实际开发中,有时需要考虑到兼容性问题,这两个信息还是很有用的,我一般都是程序开始时读取,存到公共变量里。 #import "sys/utsname.h"   /*!  *  get the information of the device and system  *  "i386"          simulator  *  "iPod1,1"       iPod Touch  *  "i

在实际开发中,有时需要考虑到兼容性问题,这两个信息还是很有用的,我一般都是程序开始时读取,存到公共变量里。

#import "sys/utsname.h"

 

/*!

 *  get the information of the device and system

 *  "i386"          simulator

 *  "iPod1,1"       iPod touch

 *  "iPhone1,1"     iPhone

 *  "iPhone1,2"     iPhone 3G

 *  "iPhone2,1"     iPhone 3GS

 *  "iPad1,1"       iPad

 *  "iPhone3,1"     iPhone 4

 *  @return null

 */

- (voID)getDeviceAndOSInfo

{

    //here use sys/utsname.h

    struct utsname systemInfo;

    uname(&systemInfo);

    //get the device model and the system version

    NSLog(@"%@",[Nsstring stringWithCString:systemInfo.machine enCoding:NSUTF8StringEnCoding]);

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

}

总结

以上是内存溢出为你收集整理的IOS开发之──获得设备类型和系统版本号全部内容,希望文章能够帮你解决IOS开发之──获得设备类型和系统版本号所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1093827.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存