Alamofire swift库版本4.4没有安装在swift 3.0.2项目中

时间:2017-03-02 12:47:29

标签: ios iphone swift xcode alamofire

我正在尝试使用pod在我的快速项目中安装Alamofire 4.4我正在遵循给定链接的步骤(https://github.com/Alamofire/Alamofire) 但我面临这个问题: -

[!] Unable to satisfy the following requirements:

- `Alamofire (~> 4.4)` required by `Podfile`

None of your spec sources contain a spec satisfying the dependency: `Alamofire (~> 4.4)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

我在我的系统中:  Mac os:10.12.2  x_code版本:8.2.1  swift版本:3.0.2

pod文件配置:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'testAlarmofireAndswiftyJson' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for testAlarmofireAndswiftyJson
  pod 'Alamofire', '~> 4.4'
end

我在这里请求帮助。

4 个答案:

答案 0 :(得分:11)

在终端上执行以下操作

platform :ios, '10.0'

target 'project_name' do
    pod 'Alamofire', '~> 4.4'
end

然后将pod文件配置更改为' 9.0'到' 10.0'

'pod install'

更改podfile配置后打开终端并转到项目路径。 然后执行以下

<md-ink-bar>

答案 1 :(得分:0)

您需要在Podfile中添加source语句,以便CocoaPods知道在哪里搜索您引用的pod。您可能希望将它放在Podfile的顶部:

source 'https://github.com/CocoaPods/Specs.git'

答案 2 :(得分:0)

  构建CocoaPods 4.0.0 +。

需要

Alamofire 1.1.0+

要更新CocoaPods,您只需再次安装宝石

$ [sudo] gem install cocoapods

或者预发布版本

$ [sudo] gem install cocoapods --pre

然后再试一次

答案 3 :(得分:0)

Podfile:

50, 674, {x: 50, y: 674} // everything is right, but how? Where?

bash命令:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target '02-Weibo' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!

    # Pods for 02-Weibo

       pod 'Alamofire', '~> 4.4'
       pod 'SnapKit', '~> 3.2.0'
end

你可以试试bash命令:

appledeMacBook-Pro:Weibo apple$ pod install
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.1.0)
Installing Alamofire (4.4.0)
Installing SDWebImage (4.0.0)
Installing SVProgressHUD (2.1.2)
Installing SnapKit (3.2.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `Weibo.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 6 dependencies from the Podfile and 5 total pods installed.

[!] There are duplicate dependencies on `SnapKit` in `Podfile`:

- SnapKit (~> 3.2.0)
- SnapKit