ios - 如何在 CNContact swift 中查看联系人来源?

标签 ios swift google-contacts-api swift3 cncontact

在联系人应用程序中有像“iCloud”、“yahoo”、“gmail”这样的组。在 swift 中,是否可以仅从 gmail 源获取联系人?

最佳答案

测试代码。希望它能解决您的问题...

   func getAppropriateName(for container: CNContainer?) -> String? {
        var name = ""
        if (container?.name == "Card") || container?.name == nil {
            name = "iCloud"
        }
        else if (container?.name == "Address Book") {
            name = "Google"
        }
        else if (container?.name == "Contacts") {
            name = "Yahoo"
        }
        else {
            name = "Facebook"
        }
        return name
    }

关于ios - 如何在 CNContact swift 中查看联系人来源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38825805/

相关文章:

ios - 应用名称中的空格-iOS

ios - UICollectionView reloadData 在 iOS 7 中无法正常运行

ios - RLMObject 无法用作普通对象

ios - SceneKit 子节点位置在父节点旋转期间未更改

ios - 如何将 NSTimer 上的剩余时间作为 double

javascript - 我需要 Google Plus 个人资料 ID 以及 Google Contacts v3 API

php - Google 通讯录 API - 无重定向

ios - 无法通过 Storyboard 动画化事件指示器

ios - 向具有多个自定义注释 View 的 map View 添加集群注释