It seems I came across a very special case where the locale of the app would just freak out.
I am changing the default locale of the app by using something like this:
[[NSUserDefaults standardUserDefaults] setObject:@[@"ar"] forKey:@"AppleLanguages"];
Then, I was trying to get the preferred language and create a locale object from it using:
NSString* langPrefix = [NSLocale preferredLanguages][0];
Finally, create a new NSLocale
object from the returned object. When testing the code, I would change the language from within the app, then close the app through Xcode. I am assuming that the NSUserDefaults
would not synchronize, but even if I called the synchronize
method, it would still screw up.
Bottom line is, testing localization should be done by deploying the app, and after the device has been disconnected from Xcode, so the app would run through all the life-cycle stages properly.