iOS Objective-Zip corruption issues -
i using flyingdolphinstudio's objective-zip objective-c zipping library. using zip .txt file following answer given in this question.
for case, not have array cycle through single file have following:
zipfile *zipfile= [[zipfile alloc] initwithfilename:zip_file_name mode:zipfilemodecreate]; nsdictionary *attributes = [[nsfilemanager defaultmanager]attributesofitematpath:txt_file_name error:&error]; nsdate *date = [attributes objectforkey:nsfilecreationdate]; nsdata *filedata = [nsdata datawithcontentsoffile:txt_file_name]; zipwritestream *stream = [zipfile writefileinzipwithname:txt_file_name filedate:date compressionlevel:zipcompressionlevelbest]; [stream writedata:filedata]; [stream finishedwriting]; [zipfile close];
the zipping process seems work, .zip file correct name , non-zero size. however, when try , un-zip on mac, runs .cpgz loop. , judging this article, presume because file getting corrupted somewhere in there. when upload server , try open on linux machine, spits out @ error:
$ unzip cocr2_100.zip archive: cocr2_100.zip end-of-central-directory signature not found. either file not zipfile, or constitutes 1 disk of multi-part archive. in latter case central directory , zipfile comment found on last disk(s) of archive. note: cocr2_100.zip may plain executable, not archive unzip: cannot find zipfile directory in 1 of cocr2_100.zip or cocr2_100.zip.zip, , cannot find cocr2_100.zip.zip, period.
which suggests corrupted.
does have ideas why may getting corrupted? thanks!
solved switching different zip client. moved objective-zip ziparchive , seemed work fine.
Comments
Post a Comment