I have a problem adding libs for zip extraction to my iPhone app.
I decided to use SSZipArchive. It uses minizip.
After following the instructions:
1 Add SSZipArchive.h, SSZipArchive.m, and minizip
2 Add the libz library to your target
I still get errors:
Symbol(s) not found.
I tried adding -lz to Other Linker Flags and adding lybz.dylib but it didn't help. Please let me know if you know how to get libz to work here.
Solved: Instead of using a folder, I made a yellow reference group, removed /minizip/ from includes and now everything works.
unzOpen
, unzOpenCurrentFile
, and unzOpenCurrentFilePassword
are functions defined in the minizip library. The linker is complaining that it can't find those functions, which means they're not getting compiled or linked in properly.
Make sure that minizip/unzip.c
is included in your project properly and double-check that it's getting compiled and linked.
The key to this is to make sure
All the .c files under /minizip/ are added to "Build Phases >
Compiled Sources"
For Cordova developers who want to use SSZipArchive , make sure you don't include the whole /minizip/ folder as source file in plugin.xml ,
<source-file src="src/ios/minizip"/>
^^^^^^^^No!
Include them separately as and :
<header-file src="src/ios/minizip/crypt.h" target="crypt.h" />
<source-file src="src/ios/minizip/ioapi.c" target="ioapi.c" />
<header-file src="src/ios/minizip/ioapi.h" target="ioapi.h" />
<source-file src="src/ios/minizip/mztools.c" target="mztools.c" />
<header-file src="src/ios/minizip/mztools.h" target="mztools.h" />
<source-file src="src/ios/minizip/unzip.c" target="unzip.c" />
<header-file src="src/ios/minizip/unzip.h" target="unzip.h" />
<source-file src="src/ios/minizip/zip.c" target="zip.c" />
<header-file src="src/ios/minizip/zip.h" target="zip.h" />