ios - 在 iOS 上使用 libPhoneNumber 列出所有国家/地区的代码和调用代码

标签 ios objective-c swift libphonenumber

我遇到了这个Stackoverflow Thread about listing countries and it's calling codes using libPhoneNumber library

解决办法是这样的

Use the getSupportedRegions() method, then iterate these regions calling getCountryCodeForRegion().

但是,接受的解决方案不适用于 iOS 版本的 libPhoneNumber。 getSupportedRegions() 在 iOS 版本上不可用

有什么想法可以在 iOS 使用 libPhoneNumber 中执行此操作吗?

最佳答案

解决方案是:

import libPhoneNumber_iOS


override func viewDidLoad() {
    super.viewDidLoad()

    let phoneUtil = NBPhoneNumberUtil()
    let regions = phoneUtil.getSupportedRegions()
}

关于ios - 在 iOS 上使用 libPhoneNumber 列出所有国家/地区的代码和调用代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30979188/

相关文章:

ios - 如何增加plist文件中UILabel的行间距

objective-c - 转储所有分配的对象

ios - 我如何使用 block 来更改 iOS 中的执行上下文?

ios - UIScrollView 如何更改框架而不更改边界? UIScrollView 是如何工作的?

ios - 停止 NSURLRequest 写入缓存

xcode - 带有 Swift 的 xcode 6 中的 iAd

swift - 简单的 UITableView 源文件中的编辑器占位符错误

iphone - 如果手机未连接到互联网,请加载不同的 Nib

javascript - 在 ios 应用程序中使用 google maps javascript api

iOS:将数据从 ChildViewController 传递到 GrandParentViewController?