Until now i have used this code to retrive phone language:
NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0];
As we already now, apple since IOS 9 has changed the return of this function, from something like "en" to something like "en-GB".In my apps i usually do an "istostring" to check with wich language i have to work. Now i need to implement something like the correct answer to this question
And i have to implement a condition in every method call to check if the device is IOS <9 or IOS >=9. This apple's change seems to not consider any older version compatility problems,i made an intensive use of this function, so i have to update all my apps...Maybe the problem is another, there's a better way to check the actual language of the phone?
Unfortunately, its a common pain shared by developer community and there is nothing much we can do to address this.
However, I safeguard myself by adding a category on UIDevice
like this:
+ (NSString *)deviceLanguage {
return [[NSLocale preferredLanguages] objectAtIndex:0];
}
Then simply call:
[UIDevice deviceLanguage]
to get the device language. At least, like in your case, if you are using this feature multiple places, there is only one place change to make the entire app align to new language/OS support.