我使用Sharesheet向提醒,iMessage,邮件,便笺共享文本和URL。
在iMessages上,邮件和便笺正常显示文本和URL。
但是在提醒中,什么也没有显示。
下面是我的源代码:
let activityViewController = UIActivityViewController(activityItems: [self], applicationActivities: nil)
=======
extension ShareActivityItemSource: UIActivityItemSource {
public func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any {
return self.title
}
public func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivityType?) -> Any? {
return "\(self.title)\t\n\(self.url)"
}
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) -> String {
return self.title
}
@available(iOS 13.0, *)
func activityViewControllerLinkMetadata(_ activityViewController: UIActivityViewController) -> LPLinkMetadata? {
let metadata = LPLinkMetadata()
metadata.title = self.title
metadata.url = self.url
metadata.iconProvider = NSItemProvider(contentsOf: self.thumbnailUrl)
return metadata
}
}