From f074a9bee45b0ebec230d9e271819aa58e1cf603 Mon Sep 17 00:00:00 2001 From: Morgan Dock Date: Mon, 20 Mar 2023 12:58:07 -0700 Subject: [PATCH] ensure country codes are capitalized per ISO specs (#612) --- PhoneNumberKit/PhoneNumberKit.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PhoneNumberKit/PhoneNumberKit.swift b/PhoneNumberKit/PhoneNumberKit.swift index 6b7a10627..bc0590371 100644 --- a/PhoneNumberKit/PhoneNumberKit.swift +++ b/PhoneNumberKit/PhoneNumberKit.swift @@ -299,10 +299,10 @@ public final class PhoneNumberKit: NSObject { // macCatalyst OS bug if language is set to Korean //CNContactsUserDefaults.shared().countryCode will return ko instead of kr // Failed parsing any phone number. - let countryCode = CNContactsUserDefaults.shared().countryCode + let countryCode = CNContactsUserDefaults.shared().countryCode.uppercased() #if targetEnvironment(macCatalyst) if "ko".caseInsensitiveCompare(countryCode) == .orderedSame { - return "kr" + return "KR" } #endif return countryCode @@ -316,6 +316,8 @@ public final class PhoneNumberKit: NSObject { } return PhoneNumberConstants.defaultCountry } + + /// Default metadata callback, reads metadata from PhoneNumberMetadata.json file in bundle ///