ios - Xcode 找不到 Alamofire,错误 : No such module 'Alamofire'

标签 ios xcode swift cocoapods alamofire

我正在尝试按照 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/

相关文章:

ios - 在 iOS 中将 RGB 像素数据高性能复制到屏幕

xcode - FBConnect 问题?

ios - 将背景图片设置为 iPad 应用程序的正确方法

swift - 一个 UIViewController 中的多个 UICollectionView 数据源

swift - 在向 AWS 存储发送 put 请求期间获取 "the request is time out"

ios - 捕获组正则表达式 NSRegularExpression iOS

iOS加载新 Storyboard

ios - 台风将属性注入(inject)新对象

objective-c - UItextFields 数据到 JSON

ios - 防止自动登录时显示登录屏幕