From 493aaca24260b971efb5e6bdf524e23db29aee54 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 19 Jul 2017 14:21:54 -0400 Subject: [PATCH] Avoid nil country names on iOS 8. // FREEBIE --- src/Contacts/PhoneNumberUtil.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Contacts/PhoneNumberUtil.m b/src/Contacts/PhoneNumberUtil.m index 9bd8dbf5c..8fe4d5c9c 100644 --- a/src/Contacts/PhoneNumberUtil.m +++ b/src/Contacts/PhoneNumberUtil.m @@ -85,6 +85,9 @@ NSDictionary *countryCodeComponent = @{NSLocaleCountryCode : countryCode}; NSString *identifier = [NSLocale localeIdentifierFromComponents:countryCodeComponent]; NSString *country = [NSLocale.currentLocale displayNameForKey:NSLocaleIdentifier value:identifier]; + if (country.length < 1) { + country = [NSLocale.systemLocale displayNameForKey:NSLocaleIdentifier value:identifier]; + } return country; }