Recently I started a project which must understand the CBR format, for those that doesn’t know, CBR is a comics file format, which consists of several image files archived in RAR archive format.
In order to be able to read CBR archive contents and uncompress them I need to port unrar library to iOS, after some quick research I found an existing work done in this way, it’s pretty old, but gave me some insight about how to start.
I decided to start a static library project on XCode, the work started by copying the entire sources of unrar library and try build the project, at first time I got several compiler errors, I could fix few of them, after some hours fixing compiler errors I started to take a look on makefile found here, this makefile helped a lot me here and the project could be successfully compiled.
My next step was create a example project, I could get some a better idea about how to work with unrar library by taking a look on the sources of this project, after some hours reading the sources I could list archive contents and few days later extract one file from archive as stream.
Now with static library and example project working as expected, it’s time to polish a little, I wrote a small Objective-C class called Unrar4iOS, this class act as wrapper class of unrar cpp code, with this class the work with unrar library became a much more easier task, after get this class working as expected I researched a little to figure out how to package the static library as framework, you can find some good info about how do it here.
The final result is a github project called Unrar4iOS, got there and clone or fork it!