获取图像名称通过从的UIImagePickerController采摘相机图像并将其保存到相册的照片在IOS

问题描述:

我保存的图像与功能的相机胶卷后...获取图像名称通过从的UIImagePickerController采摘相机图像并将其保存到相册的照片在IOS

UIImageWriteToSavedPhotosAlbum(imurl!,零,零,零)

如何获取保存的图像的名称或URL与功能?

+0

请出示您在您的项目尝试 –

您可以使用ALAssetsLibrary框架将图像保存到磁盘上。

请尝试以下方法 -

ALAssetsLibrary().writeImageToSavedPhotosAlbum(editedImage.CGImage, orientation: ALAssetOrientation(rawValue: editedImage.imageOrientation.rawValue)!, 
      completionBlock:{ (path:NSURL!, error:NSError!) -> Void in 
       print("Image path - \(path)") 
     }) 
+0

没有实际上这是在IOS depreceated您捕捉代码9.0 –

+0

你@SaikrishnaBurra HTTPS新的解决方案:// WWW .hackingwithswift.com/example-code/media/uiimagewritetvedvedphotosalbum-how-to-the-ios-photo-album – Meet

+0

没有兄弟......这没有帮助我....完成保存后如何获得图像名称? –

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { 

      let imageUrl = info[UIImagePickerControllerReferenceURL] as! NSURL 
      // here you got file path that you select from camera roll 

      let image = info[UIImagePickerControllerOriginalImage] as! UIImage 
     // here you got image that select from camera roll now just save it 

     self.dismiss(animated: true, completion: nil) 
} 
+0

即时获取imageUrl为零,谢谢。任何其他方式? –

+0

你确定你得到零,因为我从来没有得到它无这个代码我已经在我目前的应用程序中使用。 –

+0

是的,我得到零.......再次检查...你把图像保存到相册吗? –