我试图在Github之后将Alamofire包含在我的Swift项目中( github / Alamofire / Alamofire#cocoapods )指示。
I'm trying to include Alamofire in my Swift project following the github(github/Alamofire/Alamofire#cocoapods) instruction.
我创建了一个新项目,导航到项目目录并运行此命令 sudo gem install cocoapods 。然后我面临以下错误:
I've created a new project, navigated to the project directory and run this command sudo gem install cocoapods. Then I faced following error:
ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod搜索后我设法安装 cocoapods 通过运行此命令 sudo gem install -n / usr / local / bin cocoapods
After searching I managed to install cocoapods by running this command sudo gem install -n /usr/local/bin cocoapods
现在我通过 pod init 生成一个pod文件并以这种方式进行编辑:
Now I generate a pod file by pod init and edited it this way:
# 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 语句给出了以下错误没有这样的模块'Alamofire'
Finally I run pod install to install Alamofire. After that I open the project and import Alamofire statement gives me following error No such module 'Alamofire'
更新-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
Open the .xcworkspace not the .xcodeproj
更多推荐
Xcode找不到Alamofire,错误:没有这样的模块'Alamofire'
发布评论