"No such module 'Alamofire'" Xcode 无法识别 Alamofire 框架

"No such module 'Alamofire'" Xcode won't recognize Alamofire framework

我意识到在其他问题(如 here)中也提出了同样的错误,但他们的解决方案对我不起作用。 我的应用程序一直出现构建失败:"No such module 'Alamofire'"。我按照 cocoadocs 安装说明 (here) 安装了 Alamofire,但它仍然无法正常工作。我确保一切都具有相同的部署目标。
Embedded Binaries and Frameworks

这是我的播客文件文本。

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

此外,我在终端中再次尝试“$ 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.

按照 Sohil 的建议,XCode 现在可以识别 Alamofire 模块,但是出现了 22 个新问题。

更新 #2:所以我现在使用的是 Xcode 7.3 和 Swift 2.2,但是我收到工作区 Link 的新错误:"ld: framework not found Alamofire. clang: error: linker command failed with exit code 1 (use -v to see invocation)."

执行以下操作,您可以从 "Pods"

导入任何 swift 文件

1) Clean your project

2) Make sure that all your "Pods" > "Build Settings" > "Build Active Architecture Only" is set to "NO".

3) Don't run, just build your project.

4) Now, import any file from "Pods" to any swift file

E.g.: import Alamofire

5) Again, build project and it will work as expected. Finally, you can access it properties

更新:

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

希望对您有所帮助!

请检查此屏幕截图 并与您的构建设置进行比较 可能对你有帮助

对我来说,解决方案是按照 cocoapods documentation

的指示打开 "App".xcworkspace

步骤是:

  1. 关闭项目
  2. 关闭xcode
  3. 转到终端
  4. 输入"open |App|.xcworkspace"

当我打开Xcode时,它仍然指向错误,然后我构建了项目(cmd+b),现在一切正常。

目标覆盖 OTHER_LDFLAGS 构建设置。

在 TARGENTS -> 构建设置 -> 框架搜索路径中使用 $(inherited) 标志

就我而言,更改包名称后我无法 运行 存档。我已经清理了构建文件夹和 运行 pod install 然后一切正常。