Firebase에서 다운로드 한 이미지를 추가하는 데 도움이 필요하므로 UIActivityViewController를 통해 공유 할 수 있습니다. 올바른 이미지를 얻지 만 공유 할 수 있도록 데이터 패스 설정 방법을 확신 할 수 없습니다. 현재 설정은 "objectsToShare = [self.image!]"에 "Thread 1 error"를 발생시킵니다. 아래의 장소에서Swift Firebase UIActivityViewController에 대한 이미지 추가
let shareAction = UIAlertAction(title: "Share", style: UIAlertActionStyle.default, handler: {(alert: UIAlertAction!) in
var objectsToShare: [AnyObject]?
let titlePost = self.feeds[sender.tag].downloadURL
if let postURL = URL(string: titlePost) {
let postRequest = URLRequest(url: postURL)
self.image?.setImageWith(postURL, placeholderImage: nil, options: SDWebImageOptions.progressiveDownload, completed: { (imageRequest, imageResponse, error) -> Void in
// failure downloading image
print("Error downloading Firebase post image")
print(error)
})
}
objectsToShare = [self.image!]
let activityViewController = UIActivityViewController(activityItems: objectsToShare!, applicationActivities: nil)
// present the view controller
self.present(activityViewController, animated: true, completion: nil)
})
"objectsToShare"를 nil로 지정하십시오. 이미지를 올바르게 다운로드하지 않을 수 있습니까? –
이미지를 올바르게로드하는 데 약간의 시간이 걸립니다. 이미지를 할당 할 때 다운로드하지 않을 수 있습니다. 따라서 해당 코드를 완료 블록으로 이동 한 다음 테스트하십시오. –