“Untar” file on iPhone

放肆的年华 提交于 2020-01-21 02:59:26

问题


I'm writing an iPhone app which downloads a tar-gzipped file from a Webserver, then needs to unarchive this file so that it can be copied into the app's Documents folder.

I'm using tar/gzip because I want to download a whole bunch of small files in one HTTP request, to make everything nice and fast.

I've investigated solutions like http://www.feep.net/libtar/, but as a C/Objective-C newb, I can't get any of them to compile for the iPhone platform.

(I felt like I should just be able to do a system call to "tar -zxvf myfile.tar.gz", but it would appear it's not that easy!)

So is there a simple way to just un-tar a file on the iPhone? Or am I going about this all wrong, and is there a better way to do this?

Thanks in advance!

Nik


回答1:


This blog post should help you: http://blog.hawkey.org/?p=332

EDIT: Google cache version of the same page which actually links to a forum post here which links to a Google Code project here, containing some code which implements unzipping on iOS.




回答2:


Here is a light untar library for iOS : https://github.com/mhausherr/Light-Untar-for-iOS

Complete blog post about the solution : http://blog.octo.com/en/untar-on-ios-the-pragmatic-way/

Hope this helps, Vincent




回答3:


I took a different approach by building libarchive and bz2lib as a static library for iOS. You can find it here:

http://github.com/davepeck/iOS-libarchive/



来源:https://stackoverflow.com/questions/1811608/untar-file-on-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!