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.
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.
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.
Fixed by creating an empty swift file in the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With