解决:Warning: CocoaPods minimum required version 1.6.0 or greater not installed.

一、问题场景

Flutter  编译打包到模拟器时,提示 CocoaPods 版本低,需要升级到至少 1.6.0 以上。

二、详细提示信息

Warning: CocoaPods minimum required version 1.6.0 or greater not installed. Skipping pod install.
  CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
  Without CocoaPods, plugins will not work on iOS or macOS.
  For more info, see https://flutter.dev/platform-plugins
To upgrade:
  sudo gem install cocoapods
  pod setup

Running Xcode build...
Xcode build done.                                            2.2s
Failed to build iOS app
Error output from Xcode build:
↳
    2019-08-01 14:02:29.561 XCBBuildService[81184:401510] Failed to remove: /Users/xiaogu/Library/Developer/Xcode/DerivedData/Runner-bwwjuaziturroudcwqyinhudqvqm/Build/Intermediates.noindex/XCBuildData/5f82ca94870db05f120019d5115029a7-desc.xcbuild: unlink(/Users/xiaogu/Library/Developer/Xcode/DerivedData/Runner-bwwjuaziturroudcwqyinhudqvqm/Build/Intermediates.noindex/XCBuildData/5f82ca94870db05f120019d5115029a7-desc.xcbuild): No such file or directory (2)
    ** BUILD FAILED **


Xcode's output:
↳
    error: /Users/xiaogu/Project/cakeboss_app_flutter/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
    error: /Users/xiaogu/Project/cakeboss_app_flutter/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
    error: /Users/xiaogu/Project/cakeboss_app_flutter/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
    error: /Users/xiaogu/Project/cakeboss_app_flutter/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
    error: /Users/xiaogu/Project/cakeboss_app_flutter/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
    error: /Users/xiaogu/Project/cakeboss_app_flutter/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
    warning: Capabilities for Runner may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the build settings editor. (in target 'Runner')
    note: Using new build systemnote: Planning buildnote: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone Xʀ.

三、问题解决

1、先看一下当前 CocoaPod 版本

$ pod --version
1.5.0

果然版本不够,急需升级 !

2、错误提示中有说到怎样升级

To upgrade:
  sudo gem install cocoapods
  pod setup

执行命令后:

Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from http://gems.ruby-china.org/ - bad 
response Not Found 404 (http://gems.ruby-china.org/specs.4.8.gz)

提示找不到资源 !

后来在网上搜索,原因是 gems.ruby-china 的域名变了,由 org 改为了 com。

3、修改 source 路径

1、删除 gem 源:

gem sources --remove https://gems.ruby-china.org

2、修改 gem 源:

gem sources -a https://gems.ruby-china.com

4、升级 cocoapod

sudo gem install cocoapods

5、检查当前 pod 版本

$ pod --version
1.9.1

执行完以上步骤之后再编译打包到模拟器就不会有这样的错误提示了。

 

搞定 !

你可能感兴趣的:(Flutter-遇到的坑,Flutter,pod,gem,升级)