Does anyone know how to acquire the absolute path from an image using iOS Swift? I am trying to send the file path in a HTTP post request. I have tried the code below but it takes too long to process. I am trying to send the file path of an image to a PostgreSQL database. Any tips are greatly appreciated. Thank you!
var paths: NSArray = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
var documentDirectory: NSString = paths.objectAtIndex(0) as NSString
var localFilePath: NSString = documentDirectory.stringByAppendingPathComponent("image.png")
var data: NSData = UIImagePNGRepresentation(image)
data.writeToFile(localFilePath, atomically: true)