Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use RegexKitLite in Xcode 4.3.1?

I'm having trouble to use RegexKitLite to match string like

NSString *encodedPoints=[apiResponse stringByMatching: @"\\\"([^\\\"]*)\\\"^[^:]*" 
                                              capture: 0];

and apiResponse is:

@"http://maps.google.com/maps?output=dragdir&saddr=20.001364,73.749283&daddr=19.991499,73.744095"

So, to do by this way i am getting following error:

__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x131fc0

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x131fc0' * First throw call stack: (0x3422b8bf 0x3447b1e5 0x3422eacb 0x3422d945 0x34188680 0xb97b 0xad2f 0xaa2d 0xa617 0x34185435 0x375ef9eb 0x376b53cf 0x34185435 0x375ef9eb 0x375ef9a7 0x375ef985 0x375ef6f5 0x375f002d 0x375ee50f 0x375edf01 0x375d44ed 0x375d3d2d 0x30a06df3 0x341ff553 0x341ff4f5 0x341fe343 0x341814dd 0x341813a5 0x30a05fcd 0x37602743 0x4571 0x2838)

I have trying to find solution with googling but not getting exact solution.

Please help...

like image 618
Sunil Targe Avatar asked Jul 04 '12 09:07

Sunil Targe


1 Answers

Ensure you have the correct library included into your project.

Go to your Project Navigator and selet the project.

Click on the Target and select the Build Phases tab, and open the Link Binary With Libraries.

Press the + Button, and search for libicucore.A.dylib. Add this library to your project.

Next, you will need to add the compile source, which is in Compile Sources just above Link Binary With Libraries. Once again, hit the + button and add RegexKitLite.m to the target. If you attempt to build the project at this state, you should get a lot of errors in the RegexKitLite.m file. To correct this, add the following compiler flag to the file by double clicking the RegexKitLite.m file in the Compile Sources area and then including -fno-objc-arc into the pop-up that appears. Hit done, and you will have hopefully added the library source to your project.

Just as a note, -fno-objc-arc removes the Automatic Reference Counting while compiling that source file. The errors the file gets without that compiler flag have to do with ARC, so it solves the problem.

This solved my issues when working with RegexKitLite, so hopefully it will for you.

like image 86
Devin P. Avatar answered Oct 21 '22 04:10

Devin P.