JackAppDev / flutter_iap

Flutter iap plugin
MIT License
100 stars 15 forks source link

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. #17

Open alamboley opened 6 years ago

alamboley commented 6 years ago

Hello,

Just added the plugin and got this error 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. Which Swift version should also be used?

evanave commented 6 years ago

I forget which one of these fixed the issue for me, but you can try the following: You also may need to run flutter clean and may also need to de-integrate the podfile and reinstall the pods. Sorry for the lack of specificity but one of these should do the trick!

  1. add use_frameworks!
    
    target 'Runner' do
    use_frameworks!
2. pre_install

pre_install do |installer|

workaround for https://github.com/CocoaPods/CocoaPods/issues/3289

Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

end


3. post_install

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'] = '3.2' end

workaround for https://github.com/CocoaPods/CocoaPods/issues/7463

    target.headers_build_phase.files.each do |file|
        file.settings = { 'ATTRIBUTES' => ['Public'] }
    end
end

end


Edited for formatting
JackAppDev commented 6 years ago

I finally updated the plugin. It should fix this issue. Let me know if it does.

alamboley commented 6 years ago

Hey @JackAppDev , having the issue posted in #7.

Added

  1. add use_frameworks!
target 'Runner' do
    use_frameworks!

Does the trick, thanks @evanave !

JackAppDev commented 6 years ago

@alamboley could you open an issue in flutter's repo regarding plugins that use swift? I think this might be an issue they could fix.