Reputation: 2454
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.
Upvotes: 19
Views: 19674
Reputation: 316
Go to the Build Settings of your target (in this case, the youPod(in which issue) target from the Pods project). Search for the Swift Optimization Level setting. Ensure that for Debug configurations (used for development), the optimization level is set to -Onone. For Release configurations (used for production), it should be set to -O.
you try vice versa for both release and debug -Onone
Upvotes: 0
Reputation: 834
Add this in the file ios/XX.podspec
s.swift_versions = ['4.0', '4.2', '5.0']
this will remove the error.
Upvotes: 1
Reputation: 5712
In this case bridging header must be created.
Open the project with XCode. Then choose File -> New -> File -> Swift File. A dialog will be displayed when creating the swift file(Since this file is deleted, any name can be used.). XCode will ask you if you wish to create Bridging Header, click yes. (It's a major step)
Make sure you have use_frameworks! in the Runner block, in ios/Podfile.
Make sure you have SWIFT_VERSION 4.2 selected in you XCode -> Build Settings
Do flutter clean
Go to your ios folder, delete Podfile.lock and Pods folder and then execute pod install --repo-update
Upvotes: 2
Reputation: 1279
In the odd case that the other answers do not work for you, use pre_install
like:
pre_install do |installer|
installer.analysis_result.specifications.each do |s|
s.swift_version = '4.2' unless s.swift_version
end
end
A combination of the answers above and this answer will definitely sort this out.
Upvotes: 4
Reputation: 5790
Check this 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
You might check which SWIFT_VERSION
will be required, in that issue, the problem is solved using 3.2. In the answer I posted, 4.1 was recommended but 4.0 also worked.
Upvotes: 22
Reputation: 6226
Have a look at this issue: https://github.com/flutter/flutter/issues/16049
It helped me get past this for a project created without swift capability added and then adding on the geolocation plugin.
Upvotes: 2