MSConversation 为我们提供了本地参与者和远程参与者。但是,我无法检索 self 或 other 的显示名称。我如何获得这些名称? https://developer.apple.com/reference/messages/msconversation
let ids = activeConversation?.remoteParticipantIdentifiers
let otherId = ids?[0].uuidString
let ownId = activeConversation?.localParticipantIdentifier.uuidString
let predicate = CNContact.predicateForContacts(withIdentifiers: [otherId!]);
do {
let contacts = try CNContactStore().unifiedContacts(matching: predicate, keysToFetch: [CNContactFamilyNameKey, CNContactGivenNameKey, CNContactNicknameKey, CNContactIdentifierKey])
for contact in contacts{
print(contact.givenName)
print(contact.familyName)
print(contact.identifier)
}
} catch let err{
print(err)
}
如上所述,我尝试搜索 CNContactsStore,来自 MSConversation 的 UUID 与 CNContact 不同。