如何在iOS中获取设备型号?

3

我希望通过编程获取设备型号(设置->通用->关于本机->型号)。我尝试使用以下代码:

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

上面的代码返回的是“iPhone”。但我需要获取设备型号的值,该值显示在(设置->通用->关于本机->型号)中。例如,在我的iPhone中,它是“MD128HN/A”。请参见附加的快照。

enter image description here

1个回答

0
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);

2
谢谢,但这不是正确的答案。我想打印快照中我舍入的值,请检查快照。 - Sukhpal Singh

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接