Skip to content

Commit a8c90ab

Browse files
Set locale and country code only when supported by Apple OS Version (#929)
1 parent 1fd167f commit a8c90ab

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

wrappers/obj-c/ODWLogManager.mm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,15 @@ +(nullable ILogger *)initializeLogManager:(nonnull NSString *)tenantToken withCo
156156
// Obtain semantics values
157157
NSBundle* bundle = [NSBundle mainBundle];
158158
NSLocale* locale = [NSLocale currentLocale];
159-
std::string strUserLocale = std::string([[locale languageCode] UTF8String]);
160-
NSString* countryCode = [locale countryCode];
159+
std::string strUserLocale;
160+
NSString* countryCode = nil;
161+
162+
if (@available(iOS 10.0, macOS 10.12, *))
163+
{
164+
strUserLocale = std::string([[locale languageCode] UTF8String]);
165+
countryCode = [locale countryCode];
166+
}
167+
161168
if ([countryCode length] != 0)
162169
{
163170
strUserLocale += [[NSString stringWithFormat:@"-%@", countryCode] UTF8String];

0 commit comments

Comments
 (0)