I checked a lot of SO questions like this and those related to these errors, but let me tell you my script.
I load images into the view and after clicking on the objects in the collection view 18 times, my code returns this error. I am not doing anything complicated. I just add the same asset that was clicked on the view above this asset.
Information: I create assets and save them in the document catalog and receive them only from there.
Below is my code where the error occurs:
let data = try Data(contentsOf: URL(fileURLWithPath: (contentsOfFile: (userInfo[kPath] as! String))), options: .uncached)
I try to get imageData and then put it as an image in an image, but after a few clicks, the Try statement returns the following errors.
"Too many open files"
I also tried another way of loading the image ie
UIImage(contentsOfFile: imageFilePath)!
but the result will be the same.
Can someone help me by guiding how to solve this error?
source
share