flutter_vibrate icon indicating copy to clipboard operation
flutter_vibrate copied to clipboard

Failed Build Swift Language Version

Open edeuss opened this issue 6 years ago • 3 comments

Here is the error: Xcode's output: ↳ The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

This would be helpful if this is fixed fast thanks

edeuss avatar Oct 26 '18 01:10 edeuss

I solved it by following the instructions in this StackOverflow answer. (I used 4.2 for the Swift version). Quoting that answer:

When the iOS part of a plugin is coded using Swift, you must make that change to your ios/Podfile. You must add use_frameworks! and config.build_settings['SWIFT_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

dmjones avatar Oct 29 '18 06:10 dmjones

Made the additions to Podfile as per Duncan Jones above but build still fails on ios with this error:

- `vibrate` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

sjschnuggsr avatar Mar 16 '19 22:03 sjschnuggsr

I solved the problem by following steps:

  1. Add use_frameworks! and config.build_settings['SWIFT_VERSION'] = '5.0' to your Podfile.
  2. Delete the Podfile.lock in /ios directory.
  3. Open Runnner.xcworkspace, add an empty Swift file to the project and accept to add a bridging header file.
  4. Run 'flutter run'.

tamarous avatar Apr 30 '19 03:04 tamarous