I'm saving images to photolibrary using ALAssetsLibrary and printing out the url of the image file. I noticed that photos are saved to the ios device with IMG_####.jpg format where #### is some number. I would like to get the filename of the image that I just saved. Anyway to get this IMG_####.jpg file name from the url?
assetLib.writeImage(toSavedPhotosAlbum: imageToSave.cgImage, orientation: ALAssetOrientation(rawValue: imageToSave.imageOrientation.rawValue)!, completionBlock: {(url,error) -> Void in
print("image url: \(url)")
output
image url: Optional(assets-library://asset/asset.JPG?id=56963951-1CE3-4A1A-B693-804899C79BA5&ext=JPG)
In the comments of this link there is someone doing exactly what I want however I'm not too familiar with objective C and not using imagePickerController. If someone could explain to me how to do this in Swift without imagePickerController that would be awesome.
http://ootips.org/yonat/how-to-set-the-image-name-when-saving-to-the-camera-roll/
I figured it out if anyone else is interested in doing the same thing. Credits to the link I posted in question I just translated it to Swift.