注意:此问题仅适用于Swift 3.0。
在Swift 3.0之前,我能够获取路径。
我想在didFinishPickingMediaWithInfo方法中获取选定的UIImage的路径。
let imageUrl = info[UIImagePickerControllerReferenceURL] as? NSURL
let imageName = imageUrl.lastPathComponent
let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
let photoURL = NSURL(fileURLWithPath: documentDirectory)
let localPath = photoURL.appendingPathComponent(imageName!)
但是这个路径并没有指向我的图像,即使在文档文件夹中也没有任何图像。
有人能帮我吗?
imageUrl
。 - shallowThought