美文网首页iOS开发iOS开发代码段
iOS 获取设备版本、语言等信息

iOS 获取设备版本、语言等信息

作者: _lijinglong | 来源:发表于2015-08-19 16:31 被阅读388次

    UIDevice *currentDevice = [UIDevice currentDevice];

    NSString *model = [currentDevice model];

    NSString *systemVersion = [currentDevice systemVersion];

    NSArray *languageArray = [NSLocale preferredLanguages];

    NSString *language = [languageArray objectAtIndex:0];

    NSLocale *locale = [NSLocale currentLocale];

    NSString *country = [locale localeIdentifier];

    NSString *appVersion = [[NSBundle mainBundle]

    objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];

    NSString *deviceSpecs =

    [NSString stringWithFormat:@"%@ - %@ - %@ - %@ - %@",

    model, systemVersion, language, country, appVersion];

    NSLog(@"Device Specs --> %@",deviceSpecs);

    相关文章

      网友评论

        本文标题:iOS 获取设备版本、语言等信息

        本文链接:https://www.haomeiwen.com/subject/qgkgqttx.html