Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile

在mac上使用Android studio运行项目时出现如上错误,是由于Flutter引用第三方库esys_flutter_share和qr_code_tools时未指定版本。

解决办法:

修改项目里的ios/Podfile文件,

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '8.0' #增加的内容

之后又遇到如下问题

flutter Unable to determine Swift version for the following pods

是指定的SWIFT版本问题,但xcode的tagets中没有指定SWIFT_VERSION版本这一项,点buildSettings中的+号,添加SWIFT_VERSION,指定版本号4.2,再执行pod update --verbose --no-repo-update解决问题

修改项目里的ios/Podfile文件,

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'  #增加修改内容
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

之后又遇到如下问题

flutter 'qr_code_tools/qr_code_tools-Swift.h' file not found

又是修改项目里的ios/Podfile文件,

target 'Runner' do
  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  use_frameworks! # required by qr_code_tools #增加修改的内容
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')
Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐