在 Objective C 中压缩文件夹
Objective C 中是否有任何库可以用于压缩整个文件夹(并解压缩它们)?我通过搜索查看了其中一些,但它们看起来需要单独添加文件,其中一些据说会崩溃......
看起来这个库可能会工作: http://bitbucket.org/dchest/osxzip/overview
不知道是否支持然而,文件夹。有人知道它是否支持压缩文件夹或有其他库支持吗?即使是与命令行 libz 交互的示例代码对我来说也很好......
Are there any libraries that work in Objective C for zipping entire folders (and decompressing them)? I have looked at some of them by searching but they look like they require adding files individually and some of them supposedly crash...
It looks like this library might work:
http://bitbucket.org/dchest/osxzip/overview
I don't know if it supports folders, however. Anyone know if it does or have any other libraries that support zipping folders? Even sample code for interacting with the command line libz would be fine with me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 NSTask 来运行命令行同上程序。请务必查看
ditto
手册页,了解正确的标志组合,以获得与 Finder 兼容的压缩。You could use
NSTask
to run the command lineditto
program. Be sure to look at theditto
man page for the right combination of flags to get Finder-compatible zipping.根据此示例: http:// www.raywenderlich.com/1948/how-integrate-itunes-file-sharing-with-your-ios-app 你可以得到一个带有压缩数据的 NSData 对象,然后用 [data writeToFile.. ..]
According to this example: http://www.raywenderlich.com/1948/how-integrate-itunes-file-sharing-with-your-ios-app you can get a NSData Object with the Zipped Data and then just write it with [data writeToFile....]