iOS: fix locale return nil in some case

This commit is contained in:
pengfei.zhou 2021-07-08 19:26:17 +08:00 committed by osborn
parent b4493ef777
commit 98c3bc6668

View File

@ -92,8 +92,8 @@ - (instancetype)init {
@"hasNotch": @(hasNotch()), @"hasNotch": @(hasNotch()),
@"deviceBrand": @"Apple", @"deviceBrand": @"Apple",
@"deviceModel": platform, @"deviceModel": platform,
@"localeLanguage": [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode], @"localeLanguage": [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode] ?: @"",
@"localeCountry": [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode], @"localeCountry": [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] ?: @"",
}.mutableCopy; }.mutableCopy;
self.registry = [[DoricRegistry alloc] initWithJSEngine:self]; self.registry = [[DoricRegistry alloc] initWithJSEngine:self];
[self ensureRunOnJSThread:^() { [self ensureRunOnJSThread:^() {