我正在尝试按照 github( https://github.com/Alamofire/Alamofire#cocoapods ) 指令将 Alamofire 包含在我的 Swift 项目中。
我创建了一个新项目,导航到项目目录并运行此命令 sudo gem install cocoapods
。然后我遇到了以下错误:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
搜索后,我设法通过运行此命令安装 cocoapods
sudo gem install -n/usr/local/bin cocoapods
现在我通过 pod init
生成一个 pod 文件并这样编辑它:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Law
pod 'Alamofire'
target 'ProjectNameTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
最后,我运行 pod install
来安装 Alamofire。之后我打开项目并且 import Alamofire
语句给我以下错误 No such module 'Alamofire'
Update-1: pod install
的结果是:
Analyzing dependencies
Downloading dependencies
Using Alamofire (3.4.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
最佳答案
打开 .xcworkspace 而不是 .xcodeproj
关于ios - Xcode 找不到 Alamofire,错误 : No such module 'Alamofire' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37385275/