Flutter引用第三方库时Automatically assigning platform `ios` with version `8.0` on target `Runner`错误解决

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上使用引用了第三方库,发现报错,解决步骤如下:

解决办法:

1.platform version错误,解决方法是修改项目里的ios/Podfile文件:

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

之后又遇到如下问题

2.SWIFT_VERSION版本未指定问题,解决方法是修改项目里的ios/Podfile文件:

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

3.flutter 'xxxxx/xxxx-Swift.h' file not found问题:修改项目里的ios/Podfile文件

之后又遇到如下问题

flutter 'xxxxx/xxxx-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')

4.PrerollContext does not support embedding错误问题,解决方法是添加plist选项:

Trying to embed a platform view but the PrerollContext does not support embedding

解决方法:
Currently apps need to opt-in for the UIViews embedding preview on iOS by adding a boolean property to the Info.plist (key=io.flutter.embedded_views_preview value=YES).

在iOS工程的info.plist文件中添加键值对key=io.flutter.embedded_views_preview value=YES

你可能感兴趣的:(Flutter引用第三方库时Automatically assigning platform `ios` with version `8.0` on target `Runner`错误解决)