Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS fails with SWIFT_VERSION build setting must be set even after running flutter create -i swift #15

Closed
alsocalledchris opened this issue Nov 14, 2018 · 16 comments

Comments

@alsocalledchris
Copy link

Can't build the iOS app after adding this package to my project. Fails with SWIFT_VERSION error even though I have run the 'flutter create -i swift' command on the directory the project is in.

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.

Using Flutter 0.11.3 with latest XCode.

@ChiefRed
Copy link

Hi! I have here: Flutter 0.11.3 and XCode 10.1 (10B61)

Just have tried to create new project with -i swift and run code from InAppBrowser example: https://github.com/pichillilorenzo/flutter_inappbrowser#inappbrowser-class

And it's compiling! But fails at run browser - just killing app.

Then I'v removed all extra code from example:

import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';

class MyInAppBrowser extends InAppBrowser {}

MyInAppBrowser inAppBrowser = new MyInAppBrowser();

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Flutter InAppBrowser Plugin example app'),
        ),
        body: new Center(
          child: new RaisedButton(onPressed: () async {
            await inAppBrowser.open(url: "https://flutter.io/", options: {
            });
          },
              child: Text("Open InAppBrowser")
          ),
        ),
      ),
    );
  }
}

Now it's running. And for Android too.

But my main project crying about tons of errors... Looks like I need recreate it from zero.

@alsocalledchris
Copy link
Author

@ChiefRed interesting - I just get the swift version error unfortunately when adding to existing project - no other errors. Any ideas if there is a swift version file somewhere that I need to add/update?

@ChiefRed
Copy link

@alsocalledchris , already have tried this. But without success.

@alsocalledchris
Copy link
Author

So, running a brand-new fresh app from scratch using the create -i swift works and compiles fine for iOS - so odd how trying to do that to an existing app fails. However I'm seeing the same crash as you @ChiefRed when trying to view a website in inAppBrowser on iOS. @pichillilorenzo any ideas - at the moment all webview flutter plugins I've tried seem to crash with the latest flutter SDK so I don't think this is an isolated problem unfortunately.

@pichillilorenzo
Copy link
Owner

flutter create -i swift is used when you create a new fresh app and not for updating one.
@ChiefRed @alsocalledchris can you post here logs/screenshots of the errors you get? Thanks!

@ChiefRed
Copy link

@pichillilorenzo, I have recreated my main project. Now it's working.
IMHO, SWIFT_VERSION error may be just unstable environment result. Then flutter clear & relaunch IDE may help.

@chuongtrh
Copy link

Try to edit Pod file. More clear at here

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.0'  # required by simple_permission
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

@ChenArno
Copy link

Me too, my xcode version is also 10.1

@Winner28
Copy link

Same problem

1 similar comment
@Sagi363
Copy link

Sagi363 commented Jan 14, 2019

Same problem

@pichillilorenzo
Copy link
Owner

@ChenArno @Winner28 @Sagi363 did you try the solution of @chuongtrh?

Try to edit Pod file. More clear at here

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.0'  # required by simple_permission
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

@Sagi363
Copy link

Sagi363 commented Jan 17, 2019

@ChenArno @Winner28 @Sagi363 did you try the solution of @chuongtrh?

Try to edit Pod file. More clear at here

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.0'  # required by simple_permission
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

It worked finally, Thank you very much!

@pichillilorenzo
Copy link
Owner

Ok! I will add this solution in the README.md file!

@alsocalledchris
Copy link
Author

The above solution works for me - thanks everyone!

@franzejr
Copy link

I think this solution only works if you have Swift as a default language, no @pichillilorenzo @alsocalledchris ?

@horgag1
Copy link

horgag1 commented Jan 25, 2019

What worked for me was the above and then I

changed the configuration in "ios/Runner.xcodeproj/project.pbxproj":
from
VERSIONING_SYSTEM = "apple-generic";
to

SWIFT_SWIFT3_OBJC_INFERENCE=On;
SWIFT_VERSION=4.0;

There are 3 instances

@devraj-kumar devraj-kumar mentioned this issue Jul 6, 2020
5 tasks
plateaukao pushed a commit to plateaukao/flutter_inappwebview that referenced this issue Jul 27, 2020
…sign_applicationNameForUserAgent_to_WKWebViewConfiguration

TWECACAPP-709 assign applicationNameForUserAgent to WKWebViewConfiguration
@Nabouste Nabouste mentioned this issue Jul 23, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants