views:

2048

answers:

3

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

+4  A: 

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.

Jasarien
Nice, it worked, thanks.I accidentally downloaded ICU-9.11.2.tar.gz (http://www.opensource.apple.com/darwinsource/tarballs/other/ICU-8.11.2.tar.gz) and ran the make file, any idea if I need to revert anything?
Senseful
I don't get why so many people have to navigate to find the framework they want... Just open the Info window for the target, go to the first tab, and press the + button for the Frameworks group in the bottom half. It'll bring up a sheet of all the frameworks, dylibs, etc it can find in your include paths. Select libicucore.dylib and hit "OK"
Dave DeLong
Wow, I didn't know that, thanks Dave!
Jasarien
+3  A: 

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.

Alasdair Allan
A: 

I tried all that. it works in the simulator but when I deply it the app crashes...any ideas?

joevolcano