0

I try to save nsdata as a zipped file like:

 let zipArch = SSZipArchive(path: "/var/mobile/Containers/Data/Application/5F3152AA-F07A-4AD2-98A9-22051C524AF2/Library/")
 print(zipArch.writeData(andCryptedData, filename: "aFileName.zip", withPassword: "aPass"))

writeData gives me always false - If I save the file first in this folder and zip it after this, it will work - but I don't want to save the file temporary anywhere - I need a solution to save a NSData directly to a zip.

Cœur
  • 37,241
  • 25
  • 195
  • 267
kurtanamo
  • 1,808
  • 22
  • 27
  • 1
    In the path, we can see the "5F3152AA-F07A-4AD2-98A9-22051C524AF2" that may change (on each compilation). You should use `NSLibraryDirectory` for instance. – Larme Jun 12 '16 at 14:56
  • that's what I'm already using.... I just added this path for this example. – kurtanamo Jun 12 '16 at 17:24

1 Answers1

2

The right way to make nsdata directly to a zipped file is like that:

let zipArch = SSZipArchive(path: "path/to/library/directory/test.zip")
print(zipArch.open)
print(zipArch.writeData(aData!, filename: "aFileName.doc", withPassword: "aPass"))
print(zipArch.close)

print's just for checking if everything is created!

kurtanamo
  • 1,808
  • 22
  • 27