CNContactViewController for new contact imageData bug.

Originator:thesunshinejr
Number:rdar://45300537 Date Originated:16-Oct-2018 11:00 AM
Status:Open Resolved:
Product:iOS + SDK Product Version:12.0.0
Classification:UI/Usability Reproducible:Always
 
Summary:
CNContactViewController for new contact doesn't show proper avatar, set by imageData, when other contact has the same phone number.

Steps to Reproduce:
1. Add a contact with number +1 (800) 123-4567
2. Create a simple app that shows CNContactViewController for new contact:
```
    let cnContact = CNMutableContact()
    let image = UIImage(named: "")! // any valid image here
    cnContact.imageData = UIImagePNGRepresentation(image)
    cnContact.givenName = "Test"
    cnContact.phoneNumbers = [CNLabeledValue(label: CNLabelHome, value: CNPhoneNumber(stringValue: "+1 800 123 4567"))]

    let viewController = CNContactViewController(forNewContact: cnContact)
    let navigationController = UINavigationController(rootViewController: viewController)

    present(navigationController, animated: true)
```

Expected Results:
The image we assigned for the `imageData` should be in the place of the avatar.

Actual Results:
When presented, the contact will have initials (of the contact you added before) as an avatar.

Version:
12.0.0

Notes:
When you remove the old contact and present the controller again, it will have a proper avatar.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!