Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the force_load linker flag with RestKit (iOS)

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!

like image 796
ill_always_be_a_warriors Avatar asked Jun 28 '12 23:06

ill_always_be_a_warriors


2 Answers

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
like image 50
ill_always_be_a_warriors Avatar answered Oct 22 '22 22:10

ill_always_be_a_warriors


With the new Facebook SDK 3.0 for iOS the linker flags are slightly different than answered previously. I had to put:

-force_load /path/to/FacebookSDK/FacebookSDK.framework/FacebookSDK -force_load $(BUILT_PRODUCTS_DIR)/libRestKit.a
like image 40
Mike Avatar answered Oct 22 '22 23:10

Mike