我已经开始使用 AWSMobileHub,我只是在完成集成步骤,但它似乎不能很好地与我打算在项目中使用的 cocoapods 配合使用。
我已经按照集成步骤添加了从 aws + 帮助代码下载的框架。
我已经将它们添加为嵌入式框架,就像这样
这编译并运行良好
然后我使用 pod init 将 cocoapods 添加到项目中,使用以下内容编辑 podfile 并创建工作区。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'ProjectName' do
project 'ProjectName'
pod 'Fabric'
pod 'Crashlytics'
end
接下来是 pod install ,它添加了我添加到 podfile 的任何框架。
但是现在当我编译时出现以下错误。
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AWSS3PreSignedURLBuilder", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSS3ListObjectsOutput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSS3GetPreSignedURLRequest", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSS3", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
(maybe you meant: _OBJC_CLASS_$_AWSS3ContentProvider)
"_OBJC_CLASS_$_FBSDKLoginManager", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSFacebookSignInProvider.o)
"_OBJC_CLASS_$_AWSLambdaInvoker", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSCloudLogic.o)
"_OBJC_CLASS_$_AWSSNSGetEndpointAttributesInput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSPushManager.o)
"_OBJC_CLASS_$_FBSDKApplicationDelegate", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSFacebookSignInProvider.o)
"_OBJC_CLASS_$_AWSSNSSubscribeInput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSPushManager.o)
"_OBJC_CLASS_$_GIDSignIn", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSGoogleSignInProvider.o)
"_OBJC_CLASS_$_AWSSNSSetEndpointAttributesInput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSPushManager.o)
"_OBJC_CLASS_$_FBSDKAccessToken", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSFacebookSignInProvider.o)
"_OBJC_CLASS_$_AWSSNS", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSPushManager.o)
"_OBJC_CLASS_$_FBSDKGraphRequest", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSFacebookSignInProvider.o)
"_OBJC_CLASS_$_AWSS3ListObjectsRequest", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSSNSCreatePlatformEndpointInput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSPushManager.o)
"_OBJC_CLASS_$_AWSSNSUnsubscribeInput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSPushManager.o)
"_AWSSNSErrorDomain", referenced from:
___88-[AWSPushManager interceptApplication:didRegisterForRemoteNotificationsWithDeviceToken:]_block_invoke.237 in AWSMobileHubHelper(AWSPushManager.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
如果我删除嵌入式框架并将它们添加到 podfile
pod 'AWSCognitoIdentityProvider'
pod 'AWSCore'
我得到同样的错误。
这是我用于调试构建的其他链接器标志
//:configuration = Debug
OTHER_LDFLAGS = $(inherited) -l"c++"
-l"sqlite3"
-l"stdc++"
-l"z"
-framework "AVFoundation"
-framework "AWSCognitoIdentityProvider"
-framework "AWSCore"
-framework "AddressBook"
-framework "AssetsLibrary"
-framework "CFNetwork"
-framework "CoreFoundation"
-framework "CoreGraphics"
-framework "CoreLocation"
-framework "CoreMedia"
-framework "CoreMotion"
-framework "CoreText"
-framework "CoreVideo"
-framework "MessageUI"
-framework "QuartzCore"
-framework "SafariServices"
-framework "Security"
-framework "StoreKit"
-framework "SystemConfiguration"
-framework "UIKit"
//:completeSettings = none
编辑:看起来它允许在一些框架中添加 cocoapods 很好
当框架需要将 -ObjC 添加到其他链接器标志时,似乎会出现问题
OTHER_LDFLAGS = $(inherited) -ObjC -l"z" -framework "AFNetworking" -framework "AWSCognitoIdentityProvider" -framework "AWSCore" -framework "Bolts" -framework "CFNetwork" -framework "CoreGraphics" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "PureLayout" -framework "QuartzCore" -framework "Reveal"
以上是在 pod.debug.xcconfig 文件中
当我添加以下内容时,使用 aws 编译正常
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'PureLayout'
pod 'AFNetworking', '3.1.0'
作为例子
但是,如果我添加以下内容,它会添加 -ObjC 并导致所有错误
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
任何想法我应该在这里做些什么来让这些框架一起玩?
如果我尝试将显示作为 pod 文件添加到 AWSMobileHub“MySampleApp”附带的示例应用程序中,也会发生同样的情况
编辑 2:当我删除包含 AWSMobileHubHelper.framework 的 AMazonAws 文件夹并仅使用从 cocoapods 添加的 aws 文件进行编译时,它工作正常。添加 AmazonAws 文件夹时似乎会出现此问题。