如何获取我上传的图片的网址?

时间:2016-06-27 20:48:31

标签: ios swift parse-platform

我有一张个人资料照片,我正从我的画廊中选择一张照片。我想上传要解析的网址。我做得对吗?我的网址总是为零。

var fileurl = PFFile(data: UIImageJPEGRepresentation(pickedImage, 1.0)!)
print(NSURL(string: (fileurl?.url)!))

1 个答案:

答案 0 :(得分:0)

你走了。如果您从手机获取图像并希望其存储位置,则这是位置。

func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage?, editingInfo: [NSObject : AnyObject]!) {

        if let imageURL = editingInfo[UIImagePickerControllerReferenceURL] as? NSURL {
            //imageURL if the full path

            let imageName = imageURL.lastPathComponent!
            //imageName is the name and extension of the file
        }
        dismissViewControllerAnimated(true, completion: nil)
    }