Getting device info in iOS?
I'd like to find out and store information about a users device.
I'm looking for the date, the type (iPhone/iPod/iPad), the locale (Language) and location.
The date should be simple to get, as is the device type.
What code is used to find out the current locale/language of the d开发者_StackOverflowevice interface?
Check out the NSLocale
class. You can grab an instance of the current locale using +currentLocale
or +autoupdatingCurrentLocale
; the class defines a number of constants that you can use to get language and country information from that instance using its -objectForKey:
method, e.g. NSLocaleCountryCode
and NSLocaleLanguageCode
.
精彩评论