Flutter - SWIFT_VERSION must be set to a supported value

Trying out the library simple_permission, fixed the pod error and this came up, no idea how to proceed. There’s no setting for the swift version in Build Settings, I tried adding it, but it didn’t work.

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.
2 Likes

You need to specify the Swift version in post install black of the Podfile as follows:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '4.1'
    end
  end
end
1 Like

Thanks for the reply @sagar

@sagar That alone would not work. You also need to specify the use_frameworks! as well.

target 'Runner' do
  use_frameworks! # you need to add this as well. 
  ...
end

And also what @sagar suggested.

@gopalshimpi let me know if that alone worked for you.

2 Likes

It’s working for me @ashish173

1 Like