【问题标题】:Alamofire swift library version 4.4 is not installing in swift 3.0.2 projectAlamofire swift 库版本 4.4 未安装在 swift 3.0.2 项目中
【发布时间】:2017-03-02 12:47:28
【问题描述】:

我正在尝试使用 pod 在我的 swift 项目中安装 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操作系统:10.12.2 x_code 版本:8.2.1 快速版本: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

我卡在这里请帮忙。

【问题讨论】:

    标签: ios iphone swift xcode alamofire


    【解决方案1】:

    在终端上执行以下操作

    sudo gem install cocoapods --pre
    

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

    platform :ios, '10.0'
    
    target 'project_name' do
        pod 'Alamofire', '~> 4.4'
    end
    

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

    'pod install'
    

    【讨论】:

    • 我已经根据你更改了配置,但仍然出现同样的错误。
    • 如果我配置这个:platform :ios, '10.0' target 'project_name' do pod 'Alamofire' end then its intalled Alamofire v- 3.1.2
    • @DHANCHANDRASINGH :打开终端并触发此命令“pod repo update”然后尝试
    • 我已经尝试过这个命令(pod repo update),但它持续(超过 1 小时)显示: - 更新规范 repo master 执行 master 规范 repo 的深度获取以改进未来的表现。你能告诉我需要多少时间吗?
    【解决方案2】:

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

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

    【讨论】:

      【解决方案3】:

      CocoaPods 1.1.0+ 是构建Alamofire 4.0.0+ 所必需的。

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

      $ [sudo] gem install cocoapods
      

      或者对于预发布版本

      $ [sudo] gem install cocoapods --pre
      

      然后再试一次

      【讨论】:

        【解决方案4】:

        Pod 文件:

        # 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
        

        你可以试试 bash 命令:

        appledeMacBook-Pro:Weibo apple$ pod update
        Update all pods
        Updating local specs repositories
        
        CocoaPods 1.2.1 is available.
        To update use: `sudo gem install cocoapods`
        
        For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.1
        
        Analyzing dependencies
        Downloading dependencies
        Using AFNetworking (3.1.0)
        Using Alamofire (4.4.0)
        Using SDWebImage (4.0.0)
        Using SVProgressHUD (2.1.2)
        Using SnapKit (3.2.0)
        Generating Pods project
        Integrating client project
        Sending stats
        Pod installation complete! There are 5 dependencies from the Podfile and 5 total pods installed.
        appledeMacBook-Pro:Weibo apple$ 
        

        【讨论】:

          猜你喜欢
          • 2017-09-30
          • 2022-01-08
          • 1970-01-01
          • 2021-08-03
          • 2015-01-29
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多