Search code examples
swiftimessagecncontactvcf-vcardios10.3

VCF in imessage crashing due to customized CNSocialProfile service name?


I have created a vcf programatically using swift . In this vcf i have made a [CNLabeledValue<CNSocialProfile>] object , on which i have appended a CNSocialProfile with custom service name , in my case its "Instagram" .

But as soon as i share this vcf using iMessage , all devices operating on iOS 13 above crashes on clicking the vcf , but all the devices prior to iOS 13 has been working fine. Is there any way to avoid this for time being ?

This issue being custom service name in CNSocialProfile is obtained by manual testing the same and indvidually removing one element at a time as its not possible to debug iMessage app(i think).

This is the code which caused the issue:

if contact.instagram != ""
{
    socialProfiles.append(
        CNLabeledValue(
            label: "Instagram", 
            value: CNSocialProfile(
                urlString: contact.instagram, 
                username: contact.instagram, 
                userIdentifier: self.givenName, 
                service: CNSocialProfile.localizedString(
                    forService:"Instagram"
                )
            )
        )
    )
}

I want to display the custom social media links like instagram and snapchat without crashing the vcf sent through iMessage as its essential to the working of the app. Is there any way to make this possible?


Solution

  • Currently as of iOS 13.2.3 , this bug exits in iMessage app . The reason for this is due to unsupported custom label for CNSocialProfile .

    There is a work around for the same . You can have customised label in urladdress array of CNMutableContact .

    Also birthday is also not saving in contacts post iOS 13. Hope apple fixes it soon.