A scenario

Error on IOS when using a three-party library.

Recently, I have been doing bluetooth related work, and I need to use the Bluetooth library, so I found the library flutter_Reactive_BLE. When you finally run it on ios, you get an error.

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/server/Gems/molinillo - 0.6.6 / lib/molinillo/resolution. The rb: 328: in ` raise_error_unless_state ' / Library/Ruby/Gems/server/Gems/molinillo - 0.6.6 / lib/molinillo/resolution. The rb: 310: in ` block in unwind_for_conflict ' / Library/Ruby/Gems/server/Gems/molinillo - 0.6.6 / lib/molinillo/resolution. The rb: 308: in ` tap ' / Library/Ruby/Gems/server/Gems/molinillo - 0.6.6 / lib/molinillo/resolution. The rb: 308: in ` unwind_for_conflict ' / Library/Ruby/Gems/server/Gems/molinillo - 0.6.6 / lib/molinillo/resolution. The rb: 684: in ` attempt_to_activate ' / Library/Ruby/Gems/server/Gems/molinillo - 0.6.6 / lib/molinillo/resolution. The rb: 254: in ` process_topmost_state ' / Library/Ruby/Gems/server/Gems/molinillo - 0.6.6 / lib/molinillo/resolution. The rb: 182: in ` resolve ' / Library/Ruby/Gems/server/Gems/molinillo 0.6.6 / lib/molinillo/resolver rb: 43: in ` resolve ' / Library/Ruby/Gems/server/Gems/cocoapods 1.10.1 / lib/cocoapods/resolver rb: 94: in ` resolve ' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/installer/analyzer. The rb: 1074: in ` block in Resolve_dependencies'/Library/Ruby/Gems/server/Gems/cocoapods 1.10.1 / lib/cocoapods/user_interface rb: 64: in ` section ' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/installer/analyzer. The rb: 1072: in ` resolve_dependencies' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/installer/analyzer. The rb: 124: in ` analyze ' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/installer. The rb: 414: in ` analyze ' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/installer. The rb: 239: in ` block in resolve_dependencies' / Library/Ruby/Gems/server/Gems/cocoapods 1.10.1 / lib/cocoapods/user_interface rb: 64: ` in section ' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/installer. The rb: 238: in ` resolve_dependencies' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/installer. The rb: 160: in ` install! '/ Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/command/the rb: 52: in ` run' / Library/Ruby/Gems/server/Gems/claide - 1.0.3 / lib/claide/command. The rb: 334: in ` run ' / Library/Ruby/Gems/server/Gems/cocoapods - 1.10.1 / lib/cocoapods/command. The rb: 52: in ` run ' / Library/Ruby/Gems/server/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 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.Copy the code

why

Open the Pods /Local Podspecs directory in the ios project, which stores all the configuration information for the three libraries used in pubspec. Yaml, because my project was caused by the flutter_reactive_ble library. So open flutter_reactive_ble.podspec.json and you can see the following at the bottom

  "platforms": {
    "ios": "11.0"."osx": "10.13"
  }.
Copy the code

You can see what’s going on here.

This library requires the lowest version of ios to be 11.0. My project did not specify the minimum version, so it was compiled using 9.0 by default. So it says incompatible.

The solution

Open the ios/Podfile file and uncomment the second line. Change the later version to the corresponding version in the above library.

# platform :ios, '9.0' platform :ios, '11.0' platform :ios, '11.0'Copy the code

Since the minimum requirement for flutter_reactive_BLE is 11.0, you can change it to 11.0 here. Finally, after rerunning and waiting for pod install and Xcode build, you will be able to run successfully.