Using the force_load linker flag with RestKit (iOS)

ill_always_be_a_warriors picture ill_always_be_a_warriors · Jun 29, 2012 · Viewed 8.3k times · Source

I am using the Facebook iOS SDK, the AWS iOS SDK, and RestKit. To make Facebook and AWS play nice (there were duplicate symbols), I had to change my other linker flags to -force_load facebook-ios-sdk/lib/facebook-ios-sdk/libfacebook_ios_sdk.a. Now, I am getting this RestKit-related error when I run my app:

2012-06-28 15:55:15.336 MyApp[1640:707] -[__NSCFString isIPAddress]: unrecognized selector sent to instance 0x35f440

2012-06-28 15:55:15.338 MyApp[1640:707] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString isIPAddress]: unrecognized selector sent to instance 0x35f440'

I cannot use the -ObjC and all-load linker flags because that prevents me from building with Facebook and AWS.

Does anyone know how I should set my linker flags so that I can use all 3 (FB, AWS, RestKit) together? Thanks!

Answer

ill_always_be_a_warriors picture ill_always_be_a_warriors · Jun 29, 2012

Chyeahh! I figured it out. The flags should be set as

-force_load facebook-ios-sdk/lib/facebook-ios-sdk/libfacebook_ios_sdk.a -force_load $(BUILT_PRODUCTS_DIR)/libRestKit.a