【问题标题】:How to get model of device in iOS?如何在 iOS 中获取设备型号?
【发布时间】:2014-02-26 09:57:20
【问题描述】:

我想通过代码获取设备型号(Settings->General->About->Model)。我用过:

 NSString*  model=[[UIDevice currentDevice] model];

以上代码返回“iPhone”。但我需要获取(Settings->General->About->Model) 中显示的设备型号值。例如,在我的 iPhone 中,它是“MD128HN/A。请参阅随附的快照。

【问题讨论】:

    标签: iphone objective-c ios7 model


    【解决方案1】:
    NSString *platform = [UIDevice currentDevice].model;
    
    NSLog(@"[UIDevice currentDevice].model: %@",platform);
    NSLog(@"[UIDevice currentDevice].description: %@",[UIDevice currentDevice].description);
    NSLog(@"[UIDevice currentDevice].localizedModel: %@",[UIDevice currentDevice].localizedModel);
    NSLog(@"[UIDevice currentDevice].name: %@",[UIDevice currentDevice].name);
    NSLog(@"[UIDevice currentDevice].systemVersion: %@",[UIDevice currentDevice].systemVersion);
    NSLog(@"[UIDevice currentDevice].systemName: %@",[UIDevice currentDevice].systemName);
    

    【讨论】:

    • 谢谢,但这不是正确的答案。我想打印我在快照中四舍五入的值,请检查快照。
    猜你喜欢
    • 2012-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-21
    • 1970-01-01
    • 2014-05-09
    • 2015-12-02
    相关资源
    最近更新 更多