【发布时间】:2016-06-27 16:21:09
【问题描述】:
@IBAction func shareButton(sender: AnyObject) {
//Social Share Buttons..
let shareActionsheet = UIAlertController(title: "Share with", message: nil, preferredStyle: .ActionSheet)
//Facebook
let Facebook = UIAlertAction(title: "Facebook", style: .Default){(Alert:UIAlertAction!) -> Void in
let shareFacebook : SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
//screenShot
UIGraphicsBeginImageContextWithOptions(CGSizeMake(306, 441.5), false, 0)
self.view.drawViewHierarchyInRect(CGRectMake(-35, -35, self.view.bounds.size.width, self.view.bounds.size.height), afterScreenUpdates: true)
let image:UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
//screenShot finish
//创建截图图像
//shareFacebook.addImage(图片)
self.presentViewController(shareFacebook, animated: true, completion: nil)
if let user = FIRAuth.auth()?.currentUser{
//dosya upload - servise referans sağla..
let storage = FIRStorage.storage()
//referans yolu
let storageRef = storage.referenceForURL("gs://creawo-80503.appspot.com")
let data: NSData = NSData()
// Create a reference to the file you want to upload
let riversRef = storageRef.child("\(self.user!.uid+"/share_pic.jpg")/")
// Upload the file to the path "images/rivers.jpg"
let uploadTask = riversRef.putData(data, metadata: nil) { metadata, error in
if (error != nil) {
// Uh-oh, an error occurred!
} else {
我展示了路径和文件创建。让警报在图像中截取屏幕截图。我想安装firebase // 元数据包含文件元数据,例如大小、内容类型和下载 URL。
I couldn't find a solution about this place
let downloadURL = metadata!.downloadURL()
}
}
}
【问题讨论】: