与屏幕截图和文字一起分享 URL

share URL together with Screenshot and Text

我有一个非常快速的初学者问题:我怎样才能让这个函数也共享一个 URL?我总是遵循一切并认为我做对了,但它似乎不太奏效...提前致谢!

func takeSnapshot(view: UIView) {
    let bounds = UIScreen.mainScreen().bounds
    UIGraphicsBeginImageContextWithOptions(bounds.size, true, 0.0)
    self.view.drawViewHierarchyInRect(bounds, afterScreenUpdates: false)
    let image = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    let text = "Text to be shared... #Hashtag"
    let activityViewController = UIActivityViewController(activityItems: [image, text], applicationActivities: nil)
    self.presentViewController(activityViewController, animated: true, completion: nil)

只需添加一个NSURL:

let bounds = UIScreen.mainScreen().bounds
UIGraphicsBeginImageContextWithOptions(bounds.size, true, 0.0)
self.view.drawViewHierarchyInRect(bounds, afterScreenUpdates: false)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let text = "Text to be shared... #Hashtag"
let URL = NSURL(string: "http://whosebug.com/")!

let activityViewController = UIActivityViewController(activityItems: [image, text, URL], applicationActivities: nil)
self.presentViewController(activityViewController, animated: true, completion: nil)