xcode 在 RestKit (iOS) 中使用 force_load 链接器标志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11254269/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:43:53  来源:igfitidea点击:

Using the force_load linker flag with RestKit (iOS)

iosxcodefacebookamazon-web-servicesrestkit

提问by ill_always_be_a_warriors

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 flagsto -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:

我正在使用 Facebook iOS 开发工具包、AWS iOS 开发工具包和 RestKit。为了让 Facebook 和 AWS 运行良好(有重复的符号),我不得不将其他链接器标志更改为-force_load facebook-ios-sdk/lib/facebook-ios-sdk/libfacebook_ios_sdk.a. 现在,当我运行我的应用程序时,我收到了这个与 RestKit 相关的错误:

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'

2012-06-28 15:55:15.336 MyApp[1640:707] -[__NSCFString isIPAddress]:无法识别的选择器发送到实例 0x35f440

2012-06-28 15:55:15.338 MyApp[1640:707] *由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFString isIPAddress]:无法识别的选择器发送到实例 0x35f440”

I cannot use the -ObjCand all-loadlinker flags because that prevents me from building with Facebook and AWS.

我不能使用-ObjCall-load链接器标志,因为这会阻止我使用 Facebook 和 AWS 进行构建。

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

有谁知道我应该如何设置我的链接器标志,以便我可以一起使用所有 3 个(FB、AWS、RestKit)?谢谢!

回答by ill_always_be_a_warriors

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

回答by Mike

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

使用适用于 iOS 的新 Facebook SDK 3.0,链接器标志与之前回答的略有不同。我不得不说:

-force_load /path/to/FacebookSDK/FacebookSDK.framework/FacebookSDK -force_load $(BUILT_PRODUCTS_DIR)/libRestKit.a

回答by Bill Noto

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...

请注意,为了消除重复的符号,我必须删除对 Bolts 的链接引用的引用...

-l"Pods-Bolts"

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

被取出。我猜是因为 Facebook 已经以某种方式包含了它......