Lee*_*fin 15 xcode ios cocoapods swift alamofire
我跟着的指令Alamofire在github上,
我创建了一个名为cocoapods-test&I 的xcode项目.
我转到项目文件夹运行pod init命令,它生成一个Podfile.然后我将以下代码添加到Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
Run Code Online (Sandbox Code Playgroud)
然后,我运行命令pod install,这是终端中的结果:
Updating local specs repositories
CocoaPods 1.0.0.beta.6 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Installing Alamofire (3.3.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `cocoapods-test.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Run Code Online (Sandbox Code Playgroud)
然后,在我的项目文件夹中有一个名为的新文件cocoapods-test.xcworkspace.我双击它再次打开我的xcode,我可以看到Alamofire模块.
然后,我打开了我的项目ViewController类,并且import Alamofire.但无论我清理和构建多少次,我总会得到错误 No such module 'Alamofire'.这是截图:
为什么我会一步一步地按照说明解决这个问题?
(我正在使用XCode 7.2.1,Swift 2.1.1&Alamofire 3.3.0)
=======更新========
我尝试了@LK Yeung的回答,取消注释import Alamofire,然后再次清理和构建,我从Alarmofire得到了一堆编译器错误:
Sau*_*kar 10
确保已打开"project_name" .xcworkspace而不是"project_name" .xcodeproj.当您正在处理pod时,所有已安装的pod将仅在.xcworkspace项目文件中可用.
我遇到了同样的问题.请确保您使用的是Xcode 7.3并使用Swift 2.2.
你可以使用检查你的Swift版本xcrun swift -version.将Xcode更新为7.3也应该自动更新Swift.
更新Xcode为我解决了这个问题.
| 归档时间: |
|
| 查看次数: |
21738 次 |
| 最近记录: |