swift - Unarchiving a .tar file in ios 8 -
swift - Unarchiving a .tar file in ios 8 -
how untar file in ios 8?
i have followed these examples: nvhtargzip, light-untar, ziparchive have not been able create them work.
for team, used light-untar-for-ios available @ https://github.com/mhausherr/light-untar-for-ios
the actual line of code is:
if allow path = nsbundle.mainbundle().pathforresource("es_es", oftype:"tar") { allow documentdirectory:nsarray = nssearchpathfordirectoriesindomains(nssearchpathdirectory.documentdirectory, .userdomainmask, true) allow documentdirectorypath:string = documentdirectory[0] as! string var filemanager = nsfilemanager.defaultmanager() var isdirectory: objcbool = objcbool(true) if !filemanager.fileexistsatpath(documentdirectorypath + "/\(tolocale)", isdirectory: &isdirectory){ filemanager.createdirectoryatpath(documentdirectorypath + "/\(tolocale)", withintermediatedirectories: true, attributes: nil, error: &error) } var destinationpath = documentdirectorypath + "/\(tolocale)" nsfilemanager.defaultmanager().createfilesanddirectoriesatpath(destinationpath, withtarpath: path, error: &error, progress: { (progress) -> void in println("progress \(progress)") self.tartimer?.invalidate() self.tartimer = nstimer.scheduledtimerwithtimeinterval(1.0, target: self, selector: "untardone:", userinfo: [fromlocale, tolocale], repeats: false) }) }
ios swift
Comments
Post a Comment