Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install/use RegexKitLite for an iPhone application?

I'm trying to understand how to get my iPhone application working with RegexKitLite, I tried searching Google for how to install it but couldn't find anything that explains it clearly. Hopefully this will become a step-by-step guide for anyone searching for it in the future.

Alright so according to the documentation it says:

The two files, RegexKitLite.h and RegexKitLite.m, and linking against the /usr/lib/libicucore.dylib ICU shared library is all that is required.

So I downloaded the .h and .m files, now I am confused about the whole "linking against..." part. Could someone please clarify?

There's a link in the documentation to the ICU from apple's website which contains a make file among others. Do I run this make file? Do I have to be an administrator when I run it? What do I do once/if the files are "made"? How do I "link against" this? Is this done in XCode? Does it need to be done for every project that needs it? Once I've done all that, I assume all I need to do is #import the .h file and start using it, is this correct?

Thanks

like image 340
Senseful Avatar asked Aug 05 '09 10:08

Senseful


2 Answers

Add libicucore.A.dylib to your projects Frameworks group. It can be found in:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/lib/libicucore.A.dylib 

Obviously, you'll need to change the version of the iPhoneOS2.1.sdk to reflect the version of the iPhone OS you're building for, and change the iPhoneOS.platform to iPhoneSimulator.platform if you're building in the simulator.

After that you can just add the RegexKitLite source files to your project and start using them.

The "whole linking against..." part is handled by adding the libicucore library to your Frameworks group.

like image 142
Jasarien Avatar answered Nov 15 '22 21:11

Jasarien


You really shouldn't be using the Frameworks groups to add the ICU library to your project, it's not a Framework. Double-click on the project icon in Groups & Files pane in Xcode and go to the Build tab of the Project Info window, go to the Linking sub-section of the tab, double click on the Other Linker Flags field and add -licucore to the flags using the popup window.

like image 31
Alasdair Allan Avatar answered Nov 15 '22 19:11

Alasdair Allan