ios-解决报错-CocoaPods could not find compatible versions for pod “xxx“

简介: ios-解决报错-CocoaPods could not find compatible versions for pod “xxx“

出现场景

使用某个三方库时,跑在IOS上报错。

最近在用Flutter做蓝牙相关的App,需要用到蓝牙库,就找到了flutter_reactive_ble这个库。最后运行在ios上时,直接报错。提示CocoaPods could not find compatible versions for pod "flutter_reactive_ble"

详细报错信息如下

CocoaPods' output:
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `device_info_plus` from `.symlinks/plugins/device_info_plus/ios`
    -> Fetching podspec for `flutter_reactive_ble` from `.symlinks/plugins/flutter_reactive_ble/ios`
    -> Fetching podspec for `location_permissions` from `.symlinks/plugins/location_permissions/ios`
    -> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
    [!] CocoaPods could not find compatible versions for pod "flutter_reactive_ble":
      In Podfile:
        flutter_reactive_ble (from `.symlinks/plugins/flutter_reactive_ble/ios`)

    Specs satisfying the `flutter_reactive_ble (from `.symlinks/plugins/flutter_reactive_ble/ios`)` dependency were found, but they required a higher minimum deployment target.

    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1074:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error output from CocoaPods:

    [!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone 12 Pro Max.

原因

打开ios项目中的pods/Local Podspecs目录,这里面存储的是所有pubspec.yaml中使用的了的三方库配置信息,因为我这个项目是因为flutter_reactive_ble这个库而引起的问题,所以打开flutter_reactive_ble.podspec.json,在最下面可以看到以下内容

  "platforms": {
    "ios": "11.0",
    "osx": "10.13"
  },

看到这里就能知道什么问题啦了。

这个库要求ios的最低版本在11.0。而我的项目还没有指定最低版本,默认就使用了9.0来编译。所以会提示不兼容。

解决方案

打开ios/Podfile文件,将第二行的内容去掉注释。将后面的版本改为上面库里面对应的版本即可。

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

因为flutter_reactive_ble最低要求11.0,所以在这里改成11.0即可。最后重新运行,等待pod install、xcode build之后,就能成功运行起来了。

相关文章
|
3月前
|
iOS开发 MacOS Perl
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
138 4
|
3月前
|
Swift iOS开发
iOS Swift使用Alamofire请求本地服务器报错-1002
iOS Swift使用Alamofire请求本地服务器报错-1002
95 1
|
2月前
|
iOS开发
url中带中文,ios报错问题
url中带中文,ios报错问题
|
3月前
|
iOS开发
IOS编译报错‘ZipArchive.h‘ file not found|Use of undeclared identifier ‘SSZipArchive‘
IOS编译报错‘ZipArchive.h‘ file not found|Use of undeclared identifier ‘SSZipArchive‘
60 1
|
3月前
|
iOS开发
解决Flutter运行IOS报错:Podfile is out of date
解决Flutter运行IOS报错:Podfile is out of date
74 1
|
3月前
|
Android开发 iOS开发
[ionic]解决运行Android、IOS出现Could not find the web assets directory
[ionic]解决运行Android、IOS出现Could not find the web assets directory
37 1
|
3月前
|
开发工具 iOS开发 容器
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
|
4月前
|
开发工具 iOS开发 容器
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
iOS Objective-C 应用连接Azure Storage时,若不关闭账号的匿名访问,程序能正常运行。但关闭匿名访问后,上传到容器时会出现错误:“Public access is not permitted”。解决方法是将创建容器时的公共访问类型从`AZSContainerPublicAccessTypeContainer`改为`AZSContainerPublicAccessTypeOff`,以确保通过授权请求访问。
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
|
6月前
|
数据安全/隐私保护 iOS开发 Perl
Encountered an unknown error (Could not find a `ios` simulator (valid values: )
Encountered an unknown error (Could not find a `ios` simulator (valid values: )
42 0
|
6月前
|
iOS开发
iOS之使用模拟器报错:resource fork, Finder information, or similar detritus not allowed完美解决方案
iOS之使用模拟器报错:resource fork, Finder information, or similar detritus not allowed完美解决方案
142 0