与 RestKit & AWSSDKiOSv2 和链接器标志作斗争

Struggling with RestKit & AWSSDKiOSv2 and linker flags

我正在尝试在 iPhone 项目中同时使用 RestKit 和 AWSSDKiOSv2。

RestKit 希望我有这些 linker 标志:-ObjC -all_load 但 AWS SDK 宁愿我没有。这两个库彼此不兼容吗?我环顾四周,但我并没有看到太多关于他们两个的在一起,这似乎令人惊讶。

这是我在尝试保留它们时遇到的 linker 错误:

Ld /Users/williamnoto/Library/Developer/Xcode/DerivedData/HeyNay-guckyzidpqgtmvdqseouljgiefwf/Build/Products/Debug-iphonesimulator/HeyNay.app/HeyNay 正常 x86_64 cd "/Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC" 导出 IPHONEOS_DEPLOYMENT_TARGET=8.1 导出 PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/ sbin” /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/williamnoto/Library/Developer/Xcode/DerivedData/HeyNay-guckyzidpqgtmvdqseouljgiefwf/Build/Products/Debug-iphonesimulator -F/Users/williamnoto/Library/Developer/Xcode/DerivedData/HeyNay-guckyzidpqgtmvdqseouljgiefwf/Build/Products/Debug-iphonesimulator -F/Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay\ POC -F/Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay\ POC/HeyNay\ POC -filelist /Users/williamnoto/Library/Developer/Xcode/DerivedData/HeyNay-guckyzidpqgtmvdqseouljgiefwf/Build/Intermediates/HeyNay.build/Debug-iphonesimulator/HeyNay.build/Objects-normal/x86_64/HeyNay.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -all_load -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.1 - framework Bolts -framework AWSiOSSDKv2 /Users/williamnoto/Library/Developer/Xcode/DerivedData/HeyNay-guckyzidpqgtmvdqseouljgiefwf/Build/Products/Debug-iphonesimulator/libRestKit.a -framework SystemConfiguration -lz -lsqlite3 -framework MapKit -framework Mantle -framework Security -framework MobileCoreServices -framework CoreData -framework CFNetwork -Xlinker -dependency_info -Xlinker /Users/williamnoto/Library/Developer/Xcode/DerivedData/HeyNay-guckyzidpqgtmvdqseouljgiefwf/Build/Intermediates/HeyNay.build/Debug-iphonesimulator/HeyNay.build/Objects-normal/x86_64/HeyNay_dependency_info.dat -o /Users/williamnoto/Library/Developer/Xcode/DerivedData/HeyNay-guckyzidpqgtmvdqseouljgiefwf/Build/Products/Debug-iphonesimulator/HeyNay.app/HeyNay

重复符号 _OBJC_IVAR_$_BFAppLink._sourceURL 在: /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/Bolts.framework/Bolts(BFAppLink.o) /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/AWSiOSSDKv2.framework/AWSiOSSDKv2(BFAppLink.o) 重复符号 _OBJC_IVAR_$_BFAppLink._targets 在: /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/Bolts.framework/Bolts(BFAppLink.o) /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/AWSiOSSDKv2.framework/AWSiOSSDKv2(BFAppLink.o) 重复符号 _OBJC_IVAR_$_BFAppLink._webURL 在: /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/Bolts.framework/Bolts(BFAppLink.o) /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/AWSiOSSDKv2.framework/AWSiOSSDKv2(BFAppLink.o) 重复符号 _OBJC_IVAR_$_BFAppLink._isBackToReferrer 在: /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/Bolts.framework/Bolts(BFAppLink.o) /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/AWSiOSSDKv2.framework/AWSiOSSDKv2(BFAppLink.o) 重复符号 _BFAppLinkDataParameterName 在: /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/Bolts.framework/Bolts(BFAppLink.o) /Users/williamnoto/Documents/src/heynay/heynay-api/ios/HeyNay POC/HeyNay POC/AWSiOSSDKv2.framework/AWSiOSSDKv2(BFAppLink.o)

一直这样下去...

ld:133 个重复的建筑符号 x86_64 clang:错误:linker 命令失败,退出代码为 1(使用 -v 查看调用)

找到这个 link:

并将我的 linker 标记更新为:-force_load $(BUILT_PRODUCTS_DIR)/libRestKit.a

似乎一切正常。

请注意,我还仔细检查了我的导入。我最初在下面有注释掉的行,但将它们更改为未注释的行。这可能是一个混杂因素。

//#import "AWSiOSSDKv2/AWSCore.h"
//#import "AWSiOSSDKv2/AWSS3.h"
#import <AWSiOSSDKv2/AWSCore.h>
#import <AWSiOSSDKv2/AWSS3.h>