ActivityViewController无法在WhatsApp和邮件应用程序上共享链接



我使用以下代码在WhatsApp和邮件上共享一些URL。

 @objc func onclickOfShareButton(sender:UIButton){
        let myWebsite = NSURL(string:"https://myDomain/path/(String(zoomLocation.index))")
        let shareAll = [myWebsite ?? []] as [Any]
        activityViewController = UIActivityViewController(activityItems: shareAll, applicationActivities: nil)
        activityViewController.popoverPresentationController?.sourceView = self.view
        self.present(activityViewController, animated: true, completion: nil)
    }

当我与WhatsApp共享时,我无法选择需要分享的联系人。在某些情况下,我无法单击"选择联系人"。

它可以分享某个时间,但如果失败也可以分享。关闭应用并重新打开后,它可以工作2-3次。

任何帮助都会赞赏。

代码问题的时间太多,无法重复:true。当我使它们" false"时,它可以正常工作。

self.counterTimer = Timer.scheduledTimer(timeInterval: 0.5, target: self, selector: #selector(self.fetchCount), userInfo: nil, repeats: false)

计时器可能会在共享时触发AttiveViewController的指向。希望这对某人有帮助。

相关内容

最新更新