class: Contacts

通讯录

func

  • getContacts(complete: @escaping resultContacts)
    未注册过权限,进行权限注册.授权状态下读取通讯录

使用注意

  • 在info.plist 中添加位置服务权限
<!-- 通讯录 --> 
<key>NSContactsUsageDescription<key>
<string>App需要您的同意,才能通讯录<string>

使用

/// result: Array<Dictionary<String, String>>?
/// error : String?
Contacts.getContacts { (result, error) in
    if result != nil , result!.count > 0 {
        // get Contacts info
    }else if error != nil {
        // error info
    }
}

说明

  • key:
    lastName ->
    firstName ->
    fullName -> 姓名
    mobile -> 电话号码

results matching ""

    No results matching ""