我正在尝试将aws框架与本机应用程序相关联。我正在使用cocoapods,我已经在我的Podfile
中包含并安装了我需要的依赖项
platform :ios, '9.0'
use_frameworks!
target 'auth' do
inherit! :search_paths
pod 'AWSMobileClient'
pod 'AWSUserPoolsSignIn'
pod 'AWSAuthUI'
# Pods for auth
target 'authTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'auth-tvOS' do
# use_frameworks!
# Pods for auth-tvOS
target 'auth-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
这时,当我在我的import AWSMobileClient
文件中的AppDelegate.swift
时,我收到了这个错误。
No such module 'AWSMobileClient'
我还不确定是什么导致了此错误,但我还有其他AWS框架不会产生任何错误。这也可以解释为什么app build在xcode中运行时会出现故障。有什么想法吗?
安装pod后,您需要打开.xcworkspace您无法从.xcodeproj访问它们
Here是Xcode项目和Xcode Workspace之间差异的一个很好的总结。
我正在使用Xcode 9.2,使用Swift 3.2。起初我会在AppDelegate.swift文件中获得相同的“没有这样的模块'AWSMobileClient'”错误。
我的解决方案
最重要的是@Stephen Kwan [https://stackoverflow.com/a/48572298/3941896]
我的问题是当我在podfile中复制+粘贴的冗余目标时。它看起来像这样:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target :'RM1' do
use_frameworks!
# other pods
pod 'AWSMobileClient', '~> 2.6.6'
end
target 'RM1' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for RM1
target 'RM1Tests' do
inherit! :search_paths
# Pods for testing
end
target 'RM1UITests' do
inherit! :search_paths
# Pods for testing
end
end
一旦我合并了2个target: 'RM1'
,运行pod install
就可以了。