how to convert a CNPhoneNumber to string in swift4?
问题 I am using this code for getting contact number from contacts app but when I want to show the number in label I get this warning and doesn't work: Cast from 'CNPhoneNumber' to unrelated type 'String' always fails func contactPicker(_ picker: CNContactPickerViewController, didSelect contacts: [CNContact]) { contacts.forEach {(contact) in for number in contact.phoneNumbers{ let phone = number.value print(phone) numberLabel.text = phone as! String } } } 回答1: TRY : if let phone = number.value as?