如何在iOS 13上将文本和URL共享给提醒

时间:2019-12-23 08:20:26

标签: ios13 uiactivityviewcontroller reminders

我使用Sharesheet向提醒,iMessage,邮件,便笺共享文本和URL。

在iMessages上,邮件和便笺正常显示文本和URL。

see image here

但是在提醒中,什么也没有显示。

see image here

下面是我的源代码:

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
    }
}

0 个答案:

没有答案