1

我正在使用“AlamofireImage”吊舱并在集合视图单元格中显示图像,但客户端想要共享图像我正在使用它但无法正常工作:

var shareImages = [UIImage]()
    shareImages = [UIImage(named: "http://idea-factory.in/images/25-021.jpg")] as! [UIImage];
                    let activityViewController:UIActivityViewController = UIActivityViewController(activityItems:  shareImages, applicationActivities: nil)
                    let excludedTypes: [UIActivity.ActivityType] = [.postToVimeo, .postToTwitter, .assignToContact, .saveToCameraRoll]
                    activityViewController.excludedActivityTypes = excludedTypes
                    self.present(activityViewController, animated: true, completion: nil)

错误来了:线程1:信号SIGABRT

4

2 回答 2

0

我不确定这是否有帮助,但如果我没有正确链接我的视图控制器或需要强制解开一个值并且没有,我通常会收到该错误。

于 2018-09-13T11:52:12.947 回答
0

您必须在完全收到图像后使用它。您可以使用的方法之一是

let downloader = ImageDownloader()
let urlRequest = URLRequest(url: URL(string: "http://idea-factory.in/images/25-021.jpg")!)

    downloader.download(urlRequest) { response in
        print(response.request)
        print(response.response)
        debugPrint(response.result)

        if let image = response.result.value {
            //use your activity  controller here
        }
    }
于 2018-09-13T12:39:34.267 回答