Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to zip file from URL #237

Open
Zulqurn opened this issue Dec 8, 2022 · 1 comment
Open

Unable to zip file from URL #237

Zulqurn opened this issue Dec 8, 2022 · 1 comment

Comments

@Zulqurn
Copy link

Zulqurn commented Dec 8, 2022

Hi,
I am trying to zip file which I have accessed via UIDocumentPickerViewController and saving it in the same directory with source and destination url: file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Downloads/ and I am getting this error: The operation couldn’t be completed. (Zip.ZipError error 2.) with description Error: Failed to zip file.

Here is the code:
func zip(url: URL) -> URL? { do { let tokens = url.lastPathComponent.split(separator: ".") let firstToken = "\(tokens.first ?? "")" let zipFilePathURL = try Zip.quickZipFiles([url.deletingLastPathComponent()], fileName: firstToken) return zipFilePathURL } catch let error { logger.error("\(#function) Error: \(error.localizedDescription)") } return nil }

I tried to zip a .pdf file when I got this error. I will be glad if you can help me out here. Thanks in advance.

@Nassonov
Copy link

Nassonov commented Jun 5, 2023

@Zulqurn have you solved the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants