ios – Xcode找不到Alamofire,错误:没有这样的模块’Alamofire’

前端之家收集整理的这篇文章主要介绍了ios – Xcode找不到Alamofire,错误:没有这样的模块’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.之后我打开项目并导入Alamofire语句给我以下错误没有这样的模块’Alamofire’

Update-1:pod安装的结果是:

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
原文链接:https://www.f2er.com/iOS/332381.html

猜你在找的iOS相关文章