zoukankan      html  css  js  c++  java
  • 获取手机信息(UIDevice、NSBundle、NSLocale)

    UIDevice

    //设备相关信息的获取
    NSString *strName = [[UIDevice currentDevice] name];
    NSLog(@"设备名称:%@", strName);//e.g. "My iPhone"

    NSString *strId = [[UIDevice currentDevice] uniqueIdentifier];
    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

    NSBundle

    //app应用相关信息的获取
    NSDictionary *dicInfo = [[NSBundle mainBundle] infoDictionary];
    // CFShow(dicInfo);

    NSString *strAppName = [dicInfo objectForKey:@"CFBundleDisplayName"];
    NSLog(@"App应用名称:%@", strAppName);

    NSString *strAppVersion = [dicInfo objectForKey:@"CFBundleShortVersionString"];
    NSLog(@"App应用版本:%@", strAppVersion);

    NSString *strAppBuild = [dicInfo objectForKey:@"CFBundleVersion"];
    NSLog(@"App应用Build版本:%@", strAppBuild);

    NSLocale

    //Getting the User’s Language
    NSArray *languageArray = [NSLocale preferredLanguages];
    NSString *language = [languageArray objectAtIndex:0];
    NSLog(@"语言:%@", language);//en

    NSLocale *locale = [NSLocale currentLocale];
    NSString *country = [locale localeIdentifier];
    NSLog(@"国家:%@", country); //en_US

  • 相关阅读:
    技巧和诀窍;在VS 2005里优化ASP.NET 2.0Web项目的Build性能(转)
    去噪:用于验证码图片识别的类续(C#代码)
    快速申请QQ号码的技巧(图文介绍)
    vs2005中调试js
    "Take the Internet Back“挂机程序(读信息挣美元)
    javascript的编写、调试
    硬盘速度和Visual Studio性能
    Java Swing的DragAndDrop机制
    Rails 的 SNS 准备
    学习,编译ffmpeg tutorial
  • 原文地址:https://www.cnblogs.com/hissia/p/5692983.html
Copyright © 2011-2022 走看看