【flutter】ios 报错(二)

722 阅读1分钟

1、报错

 warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in
    target 'core_location_fluttify' from project 'Pods')

Encountered error while building for device.

修改Podfile文件

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
    end
  end
end

2、报错

error: No profiles for 'XXXXXX' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'XXXXXX'. Automatic
    signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from
    project 'Runner')

3、报错

Cannot find "xcodebuild". Xcode 11.0.0 or greater is required to develop for iOS.
Encountered error while building for device.

解决方案

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/

4、报错

/bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory

解决方案:

image.png

5、报错

Command PhaseScriptExecution failed with a nonzero exit code

解决方案:

image.png

6、报错

如果你直接运行 iOS 出现

CocoaPods not installed

的错误提示,那么不要着急,这个是 Android Studio 团队的锅。

\

Warning: CocoaPods 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 install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

Exception: CocoaPods not installed or not in valid state.

如果你本地已经安装了CocoaPods ,而运行时候还是会报这个错误,这时候解决的方案有几个可以选择:

  • 直接通过命令行 flutter run 运行就不会有这个问题;
  • 通过命令行 open /Applications/Android\ Studio.app 启动 Android Studio
  • 执行 chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
    (如果你使用了 JetBrains Toolbox ,那 printenv 文件路径可能会有所变化);
  • 静待 Android Studio 的小版本更新;

参考:github.com/flutter/flu…Flutter 2.10 升级指南