我尝试过搜索但找不到答案。我已经编写了一个应用程序,我正在尝试将内容分享到 Facebook。基本上我想分享一个网址,也许还有一个引言或标题。
我不断收到一个名为“保留”的错误,但我不确定它的含义或如何修复它。任何帮助都会很棒!
func fbClick() {
let content = LinkShareContent(url: URL(string: "www.google.com")!)
showShareDialog(content, mode: .native)
}
func showShareDialog<C: ContentProtocol> (_ content: C, mode: ShareDialogMode = .automatic) {
let dialog = ShareDialog(content: content)
dialog.presentingViewController = self
dialog.mode = mode
do {
try dialog.show()
} catch (let error) {
self.view.makeToast("Invalid share content. Failed to present share dialog with error \(error)", duration: 3.0, position: .top)
}
}
弄清楚了。
这条线...
let content = LinkShareContent(url: URL(string: "www.google.com")!)
本来应该是这样的...
let content = LinkShareContent(url: NSURL(string: "https://www.google.com")! as URL)
或者像这样
let content = LinkShareContent(url: NSURL(string: "https://www.google.com")! as URL, quote: quote)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)