iOS 9: get CNContact country code and phone number

后端 未结 5 1251
-上瘾入骨i
-上瘾入骨i 2020-12-09 10:42

I want to get the country code and phone number from CNContact on iOS 9. I tried many things but couldn\'t find a way. The best result I achieved is printing:



        
5条回答
  •  Happy的楠姐
    2020-12-09 11:13

    To get Country code you can use this:

    (contact.phoneNumbers[0].value ).value(forKey: "countryCode") as! String
    

    in for loop, and key; "digits" is to get full phone number.

提交回复
热议问题