Ios 颤振-SWIFT_版本必须设置为支持的值

Ios 颤振-SWIFT_版本必须设置为支持的值,ios,flutter,Ios,Flutter,尝试库simple_权限,修复了pod错误,出现了这个问题,不知道如何继续。在构建设置中没有设置swift版本,我尝试添加它,但没有成功 Launching lib/main.dart on iPhone X in debug mode... Skipping compilation. Fingerprint match. Running Xcode clean... Starting Xcode build... Xcode build done. Failed to build iOS ap

尝试库simple_权限,修复了pod错误,出现了这个问题,不知道如何继续。在构建设置中没有设置swift版本,我尝试添加它,但没有成功

Launching lib/main.dart on iPhone X in debug mode...
Skipping compilation. Fingerprint match.
Running Xcode clean...
Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
=== BUILD TARGET simple_permissions OF PROJECT Pods WITH CONFIGURATION             Debug ===
    The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
Could not build the application for the simulator.
Error launching application on iPhone X.
看看这个问题:

对于一个没有添加swift功能的项目,它帮助我克服了这个困难,然后添加了地理定位插件。

检查

当插件的iOS部分使用Swift编码时,您必须对您的
iOS/Podfile
进行更改。您必须添加
使用\u框架
config.build\u设置['SWIFT\u VERSION']='4.1'

target 'Runner' do
  use_frameworks!  # required by simple_permission
  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.1'  # required by simple_permission
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

您可以检查需要哪个
SWIFT\u版本
,在中,问题是使用3.2解决的。在我发布的答案中,建议使用4.1,但4.0也起作用。

如果其他答案对您不起作用,请使用
预安装
如:

pre_install do |installer|
  installer.analysis_result.specifications.each do |s|
    s.swift_version = '4.2' unless s.swift_version
  end
end

上面的答案和这个答案的组合肯定会解决这个问题。

通过在项目中创建一个空swift文件来修复

在这种情况下,必须创建桥接标头

  • 用XCode打开项目。然后选择文件->新建->文件->Swift文件。创建swift时将显示一个对话框 文件(由于此文件已被删除,因此可以使用任何名称。)。XCode将 询问您是否希望创建桥接标头,单击“是”。(这是一本书 (主要步骤)

  • 确保你有使用框架!在Runner块中,在ios/Podfile中

  • 确保在XCode->Build设置中选择了SWIFT_版本4.2

  • 你一定要洗干净

  • 转到ios文件夹,删除Podfile.lock和Pods文件夹,然后执行pod安装--repo更新


  • 将其添加到文件ios/XX.podspec中

    s.swift_versions = ['4.0', '4.2', '5.0']
    

    这将删除错误

    这听起来可能很疯狂,但实际上很有效(可能是因为它创建了桥接头)