折腾:
[未解决]修改或扩展CNContactPickerViewController中的显示出来的单行的联系人显示形式
中代码:
func contactPicker(picker: CNContactPickerViewController, didSelectContact contact: CNContact){ print("didSelectContact") print("contact=\(contact)") print("contact.familyName=\(contact.familyName)") print("contact.givenName=\(contact.givenName)") print("contact.phoneNumbers=\(contact.phoneNumbers)") print("contact.organizationName=\(contact.organizationName)") /* contact=<CNContact: 0x7d2e9f50: identifier=C3068F9C-6315-4345-A069-21487A740078:ABPerson, givenName=炳恋, familyName=张, organizationName=简道, phoneNumbers=( "<CNLabeledValue: 0x7d84f0d0: identifier=7D509001-2CDF-4316-BB9F-C1E21420728A, label=_$!<Mobile>!$_, value=<CNPhoneNumber: 0x7d216140: countryCode=us, digits=+8613862050544>>" ), emailAddresses=( ), postalAddresses=(not fetched)> */ let contactVC:CNContactViewController = CNContactViewController(forContact: contact) self.showViewController(contactVC, sender: self) } |
结果基本是可以的,不过此处是由于缺少一些key而出错:
Terminating app due to uncaught exception ‘CNPropertyNotFetchedException’, reason: ‘Contact 0x7d2e9f50 is missing some of the required key descriptors: ( "<CNAggregateKeyDescriptor: 0x7aee17f0: kind=+[CNContactViewController descriptorForRequiredKeys]>" )’ |
但是:
我此处已经设置了,基本的通讯参数了啊
包括名字,号码,组织等等:
搜:
CNContactViewController CNPropertyNotFetchedException
CNContactViewController forUnknownContact unusable, destroys interface
Which keys do I need for CNContactFormatter?
phone number predicate on CNContactStore
CNContactViewController Contact is missing some of the required key descriptors
试试:
// let contactVC:CNContactViewController = CNContactViewController(forContact: contact) let contactVC:CNContactViewController = CNContactViewController(forUnknownContact: contact) self.showViewController(contactVC, sender: self) |
结果错误依旧。
ios9 – Contact is missing some of the required key descriptors in ios – Stack Overflow
算了,不去解决了此问题了。
转载请注明:在路上 » [未解决]CNContactViewController出错:CNPropertyNotFetchedException Contact is missing some of the required key descriptors