2014-02-26 61 views
2

我想通過代碼獲取設備型號(Settings->General->About->Model)。我用過:如何在iOS中獲取設備的模型?

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

上面的代碼返回「iPhone」。但我需要獲取(Settings->General->About->Model)中顯示的設備型號值。例如,在我的iPhone是「MD128HN/A。請參閱隨附快照。

enter image description here

回答

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); 
+1

+1簡單的答案。 – Popeye

+2

感謝,但這不是正確的答案。我想打印的價值我在快照中四捨五入請檢查快照。 –