I am working on Localization of my app that supports both spanish and English languages.These options are listed in a tableview.On clicking English i am setting the value "en" for the key "AppleLanguages" in NSUserDefaults.So that it can show the content in English.
NSUserDefaults *nsdefault=[NSUserDefaults standardUserDefaults];
[nsdefault setObject:[NSArray arrayWithObject:@"en"] forKey:@"AppleLanguages"];
[nsdefault synchronize];
Also at the same time i am trying to fetch the Language programmatically from IOS device which was set at General>>International>>Language manually using code.
NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0];
For the very first time language gives me correct value that has been set.But If i change my option from list like Spanish or English and set value for key "AppleLanguages".It overrides the value of my device setting language.And from then ownwards i dont get the correct value of language under Setting>>International>>Language.
I want that every time i choose the language manually in settings like Francis etc.I should be able to get the newly set language.I even tried to follow the link by apple.
https://developer.apple.com/library/mac/documentation/macosx/conceptual/bpinternational/Articles/ChoosingLocalizations.html
Any help would be appreciated.