Store image securely inside app document directory iOS swift
Solution:
func saveImageDD(
let urls = FileManager.default.containerU
let fileManager = FileManager.default
let diceRoll = Int(arc4random_uniform(9999999
let name = "\(diceRoll).png"
let paths = urls?.appendingPathComponent(
let imageData = savingImage.jpegData(
fileManager.createFile(atPath: (paths?.path)!, contents: imageData, attributes: nil)
return name
}
The above code will store the image in document directory securely with appgroupname.
You cannot do this method in objective C.If you want to use this method in objective C then create delegate and call it inside objective c form swift code.
Comments
Post a Comment