Before Apple makes fix one can use the following checked solution based on NSLocale swizzling
.
In fact we only need to substitute wrong currentLocale
which is broken in iOS8.1 simulator.
Attach the category to projects and add it in .pch
file (don't forget to clear and rebuild project).
// NSLocale+ios8.h
// Created by Alexey Matveev on 01.11.2014.
// Copyright (c) 2014 Alexey Matveev. All rights reserved.
#if TARGET_IPHONE_SIMULATOR
// define here your locale identifier: de_DE, ru_RU, etc
#define LOCALE_IDENTIFIER @"de_DE"
@interface NSLocale (iOS8)
@end
#endif
// NSLocale+ios8.m
// Created by Alexey Matveev on 01.11.2014.
// Copyright (c) 2014 Alexey Matveev. All rights reserved.
#if TARGET_IPHONE_SIMULATOR
#import "NSLocale+ios8.h"
#import <objc/runtime.h>
@implementation NSLocale (iOS8)
+ (void)load
{
Method originalMethod = class_getClassMethod(self, @selector(currentLocale));
Method swizzledMethod = class_getClassMethod(self, @selector(swizzled_currentLocale));
method_exchangeImplementations(originalMethod, swizzledMethod);
}
+ (NSLocale*)swizzled_currentLocale
{
return [NSLocale localeWithLocaleIdentifier:LOCALE_IDENTIFIER];
}
@end
#endif
Hope now you see the same
One more thing, using this approach you get one pleasent side effect: keyboard chosen via category locale is always in use and doesn't depend on system settings and keyboards added. So simulator setting reset doesn't require to add your keyboard again.
The category approach allows one to override language and region settings for all targets at once without making change of these parameters in each target scheme separately.