Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDevice model vs. localizedModel

I want to use the iOS device's model name in the UI.

Since my app is localized, I figure I should use the localizedModel property of UIDevice.

So far, I've tried a few languages (Japanese, Russian, Simplified Chinese, Arabic), and localizedModel is always "iPhone."

I can't seem to find any recommendations or descriptions about this property.

Does anyone know anything about it, such as whether its values ever diverge from what the model property returns? Why does it exist?

like image 590
Tatiana Racheva Avatar asked Jul 08 '11 08:07

Tatiana Racheva


1 Answers

From the docs:

The model of the device as a localized string. (read-only)

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html

From my testing, It returned iPhone Simulator as model and localizedModel when the language was set to Russian, and iPhone for both on an iPhone 4. I'm not sure whether model is the right method to use at all, as it reports and iPhone 4 to be just an iPhone, but if that's all you want that's fine.

I really don't think that the names would be particularly localized anyway, seeing as iPhone is a trademark, it's not going to return it in Cyrillic characters.

I would say just use localizedModel, it might magically localize at some point, and it won't return a blank string.

like image 198
Greg Avatar answered Oct 30 '22 03:10

Greg