[英]VCF in imessage crashing due to customized CNSocialProfile service name?
我使用 swift 以编程方式创建了一个 vcf。 在这个 vcf 中,我创建了一个[CNLabeledValue<CNSocialProfile>]
object,我在其上附加了一个带有自定义服务名称的CNSocialProfile
,在我的例子中是“Instagram” 。
但是,一旦我使用 iMessage 共享此 vcf,在上面的 iOS 13 上运行的所有设备都会在单击 vcf 时崩溃,但 iOS 13 之前的所有设备都运行良好。 有什么办法可以暂时避免这种情况吗?
这个问题是CNSocialProfile
中的自定义服务名称是通过手动测试相同的并且一次删除一个元素来获得的,因为它无法调试 iMessage 应用程序(我认为)。
这是导致问题的代码:
if contact.instagram != ""
{
socialProfiles.append(
CNLabeledValue(
label: "Instagram",
value: CNSocialProfile(
urlString: contact.instagram,
username: contact.instagram,
userIdentifier: self.givenName,
service: CNSocialProfile.localizedString(
forService:"Instagram"
)
)
)
)
}
我想显示自定义社交媒体链接,如 instagram 和 snapchat ,而不会使通过 iMessage 发送的 vcf 崩溃,因为它对应用程序的运行至关重要。 有没有办法让这成为可能?
目前从 iOS 13.2.3 开始,此错误在 iMessage 应用程序中存在。 其原因是由于 CNSocialProfile 的自定义CNSocialProfile
不受支持。
有一个解决方法。 您可以在 CNMutableContact 的urladdress
数组中自定义CNMutableContact
。
iOS 13 之后的联系人中也没有保存生日。希望苹果尽快修复它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.