import * as Localization from 'expo-localization';
function getDeviceCountry() {
let country = "US";
console.log(Localization.locale);
return country.toLowerCase();
}
The example from the documentation works for me on both an iOS device and an Android device. Does the example work for you? If not, what SDK did you upgrade from and did you install expo-localization? Is this perhaps related to the following breaking change mentioned in the SDK 35 release notes?
Localization : replaced the country constants with region . This is now only available on iOS and Web. (Related PR.)
My app is at SDK v33. But I found this issue today since I rarely use iOS simulator.
Today I upgrade xcode to v11 and expo-cli to v3.1.2. Then tried to run my app on iOS simulator and found that this error happens. This error doesn’t happen if I run my app on expo client (v2.13.0.107059)
It is likely that this error is not related to specific expo SDK version. i doubt iOS version. iOS simulator’s iOS version is 13.0, whereas my iPhone X is 13.1.1, and my iPhone 6S is 12.3.1. Possibly this error happens only at 13.0 and related bug might be fixed at 13.1.1. Just my guess.