我有这样的代码,可以从我的osx通讯录中得到一个特定人的国家。
let address = person.value(forProperty: kABAddressProperty) as? ABMultiValue
print(((adresse?.value(at: 0) as? NSMutableDictionary)?.value(forKey: kABAddressCountryKey) as? String) ?? "No Country")
print(((adresse?.value(at: 0) as? NSMutableDictionary)?.value(forKey: kABAddressCountryCodeKey) as? String) ?? "No Country")kABAddressCountryKey的打印结果将是完整的国家。但我想要国家密码钥匙。但在第二次印刷结果中,我得到了“没有国家”
我忘了什么?
发布于 2017-09-04 19:34:19
我不认为你忘了什么。我只是重复了我的联系人,在我与各国的2020个地址中,有1368个没有国家代码。
我只是做了一个快速测试,在macOS塞拉利昂联系人应用程序中添加的联系人没有得到国家代码,而在iOS 11联系人应用程序中添加了联系人。
https://stackoverflow.com/questions/46038159
复制相似问题