我意识到在其他问题中也提出了同样的错误(例如here https://stackoverflow.com/questions/25817479/cannot-install-alamofire-in-new-xcode-project-no-such-module-alamofire),但他们的解决方案对我不起作用。
我的应用程序中不断出现构建失败:“没有这样的模块‘Alamofire’”。我按照 cocoadocs 安装说明进行操作(here http://cocoadocs.org/docsets/Alamofire/3.3.0/)用于安装 Alamofire,但它仍然无法正常工作。我确保一切都有相同的部署目标。
嵌入式二进制文件和框架 https://i.stack.imgur.com/7DhwR.png
这是我的 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
另外,我在终端中再次尝试“$ 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,但我收到工作区链接的新错误:“ld:找不到框架 Alamofire.clang:错误:链接器命令失败,退出代码 1(使用-v 查看调用)。”
执行以下操作,您可以从“Pods”导入任何 swift 文件
1)清理你的项目
2) 确保所有“Pod”>“构建设置”>“构建活动”
仅架构”设置为“否”。
3)不要运行,只构建你的项目。
4) 现在,将“Pods”中的任何文件导入到任何 swift 文件中
例如:导入 Alamofire
5)再次构建项目,它将按预期工作。最后,你可以
访问它的属性
Update:
对于更新的问题,我希望您使用的是 Xcode 7.3,所以请更新Alamofire
到斯威夫特 2.2
希望这可以帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)