14
votes

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!

3
so why exactly isn't it possible for you to just separate three -force_load flags with a space? - CodaFi
What three flags would I need to use? - ill_always_be_a_warriors

3 Answers

15
votes

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
5
votes

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
0
votes

I've struggled with this one in the past. Cocoa pods seems to simplify things a bit here. My path looks like this and I can successfully build:

-ObjC -l"Pods-AFNetworking" -l"Pods-AWSiOSSDKv2" -l"Pods-FMDB" -l"Pods-GZIP" -l"Pods-ISO8601DateFormatterValueTransformer" -l"Pods-Mantle" -l"Pods-RKValueTransformers" -l"Pods-Reachability" -l"Pods-RestKit" -l"Pods-SOCKit" -l"Pods-STTwitter" -l"Pods-SWRevealViewController" -l"Pods-TMCache" -l"Pods-TransitionKit" -l"Pods-UICKeyChainStore" -l"Pods-XMLDictionary" -l"sqlite3" -l"z" -framework "Accounts" -framework "CFNetwork" -framework "CoreData" -framework "CoreGraphics" -framework "Foundation" -framework "MobileCoreServices" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "Twitter" -framework "UIKit" -weak_framework "Social" -weak_framework "UIKit"

Note that to eliminate duplicated symbols I had to remove the reference the link reference to Bolts...

-l"Pods-Bolts"

was taken out. I guess because Facebook already includes it somehow...