"没有这样的模块'Alamofire'"Xcode将无法识别Alamofire框架

S.S*_*ohi 12 xcode ios cocoapods swift alamofire

我意识到在其他问题中也提到了同样的错误(比如这里),但他们的解决方案并不适用于我.我在我的应用程序中不断出现构建失败:"没有这样的模块'Alamofire'".我按照cocoadocs安装说明(这里)安装Alamofire,它仍然无法正常工作.我确保所有内容都具有相同的部署目标.
嵌入式二进制文件和框架

这是我的podfile文本.

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘9.2’
use_frameworks!

target 'MyApp' do
    pod 'Alamofire', '~> 3.0'
end

target 'MyAppTests' do

end

target 'MyAppUITests' do

end
Run Code Online (Sandbox Code Playgroud)

此外,我在终端再次尝试"$ pod install"并收到此消息:

[!] The `App [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
Run Code Online (Sandbox Code Playgroud)

在遵循Sohil的建议后,XCode现在认可了Alamofire模块,但出现了22个新问题.

新错误

更新#2:所以我现在使用Xcode 7.3和Swift 2.2,但是我收到了一个新的错误,工作空间链接:"ld:框架未找到Alamofire.clang:错误:链接器命令失败,退出代码为1(使用-v看到调用)."

Soh*_*mon 28

执行以下操作,您可以从"Pods"导入任何swift文件

1)清理您的项目

2)确保所有"Pods">"Build Settings">"Build Active Architecture Only"设置为"NO".

3)不要运行,只需构建您的项目.

4)现在,将任何文件从"Pods"导入到任何swift文件

例如:进口Alamofire

5)再次,构建项目,它将按预期工作.最后,您可以访问它的属性

更新:

对于更新的问题,我希望您使用Xcode 7.3,所以请更新Alamofire到Swift 2.2

希望这可以帮助!

  • 我打开了一个新项目,转移了我的文件,删除了旧项目,然后再次安装了Cocoapods和Alamofire.现在一切正常,没有错误. (2认同)