The url is duplicated when the user choose "Copy" from the activity controller in iOS 11 only. It was working properly on iOS 10
Using the below code
@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)
}
gives the shared text as:
Share Text!
http://google.comhttp://google.com
I managed to fix it by using the url as String instead of URL.
let items: [Any] = [shareText, url.absoluteString]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With