当用户仅从iOS 11中的活动控制器中选择“复制”时,该URL将重复.它在iOS 10上正常运行
使用以下代码
@IBAction func shareButtonPressed() { guard let url = URL(string: "http://google.com") else { return } let shareText = "Share Text!" let items: [Any] = [shareText,url] let activityViewController = UIActivityViewController(activityItems: items,applicationActivities: nil) present(activityViewController,animated: true,completion: nil) }
将共享文本提供为:
Share Text! http://google.comhttp://google.com
我设法通过使用URL作为String而不是URL来修复它.
原文链接:https://www.f2er.com/swift/319408.htmllet items: [Any] = [shareText,url.absoluteString]