Thursday, April 25, 2024
HomeiOS Developmentios - FileManager.default.copyItem throws error "The file does not exist"

ios – FileManager.default.copyItem throws error “The file does not exist”


I’m a newbie at SwiftUI and my apply code repo is right here. I’m attempting to make use of LLMFarm Core to create an area LLM. Whereas attempting to run this code
attempt FileManager.default.copyItem(atPath: temporaryURL.path, toPath: fileURL.path)
I am getting the error which I am guessing comes from the temporaryURL variable:
Error: The file “CFNetworkDownload_rr8uC6.tmp” doesn’t exist.

That is what my code perform seems to be like

standing = "downloading"
print("Downloading mannequin (modelName) from (modelUrl)")
guard let url = URL(string: modelUrl) else { return }
let fileURL = getFileURLFormPathStr(dir:"fashions",filename: filename)
downloadTask = URLSession.shared.downloadTask(with: url) { temporaryURL, response, error in
    if let error = error {
        return
    }
    guard let response = response as? HTTPURLResponse, (200...299).incorporates(response.statusCode) else {
        print("Server error!")
        return
    }
    do {
        if let temporaryURL = temporaryURL {
            attempt FileManager.default.copyItem(atPath: temporaryURL.path, toPath: fileURL.path)

I attempted to make use of attempt FileManager.default.copyItem(at: temporaryURL, to: fileURL) as an alternative however that did not work both.
I additionally made certain I’ve added all of the entitlements and information plist properties that appeared to be wanted utilizing the LLM farm pattern. Any assist can be vastly appreciated. The repository must be simply cloneable and you may take a look at it in your native computer systems. I attempted it on my native private gadget and M1 laptop, however bought the identical error

Edit: I additionally tried so as to add if !FileManager.default.fileExists(atPath: fileURL.path) above if let temporaryURL = temporaryURL, so the file exists however I have no idea why my code doesn’t replicate that.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments