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

hi,i meet a problem when building a ios project #37

Closed
hyz1992 opened this issue Oct 30, 2018 · 9 comments
Closed

hi,i meet a problem when building a ios project #37

hyz1992 opened this issue Oct 30, 2018 · 9 comments

Comments

@hyz1992
Copy link

hyz1992 commented Oct 30, 2018

this is xcode message box tip:
The target “permission_handler” contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift 2.x targets.

Use Xcode 8.x to migrate the code to Swift 3.

there is also other plugin writed by swift,such as fluwx. but only permission_handler show that error.
hao should i do?
thanks!

@mvanbeusekom
Copy link
Member

@hyz1992, which version of the permission_handler are you using? Our latest versions (at least version 2 and higher) are compiled using Swift 4 and Xcode 10.

@hyz1992
Copy link
Author

hyz1992 commented Oct 31, 2018

thanks,the version is lastest,but my Xcode is 9.4.1,I'm upgrading it and will try again

@hyz1992
Copy link
Author

hyz1992 commented Oct 31, 2018

Hi,I have upgrade my Xcode to 10.1,but the problem still exist.
frist,I run my helloworld project In VsCode: the log is:
=== BUILD TARGET permission_handler 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. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor. 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. Could not build the precompiled application for the device.

then I open this project in Xcode,still show a error message box:
The target “permission_handler” contains source code developed with Swift 2.x. This version of Xcode does not support building or migrating Swift 2.x targets. Use Xcode 8.x to migrate the code to Swift 3.

then I manually change the Swift Language Version to 4.0 in build setting.
Xcode say 'permission_handler/permission_handler-Swift.h' file not found.

sorry,I am a newer of ios,I hope that I have described it clearly.
thanks much for your help!

@mvanbeusekom
Copy link
Member

Hi @hyz1992, no problem at all.

Now I see the problem and it can be solved quite easily. You will just have to update your Podfile which should be in the root of you ios folder. Simply add the following line to the post_install block:

config.build_settings['SWIFT_VERSION'] = '4.1'

The end result should look similar to this:

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

More information can be found here flutter/flutter#16049

@naumanahmed19
Copy link

kindly also mention this in the description. I have wasted a day on this. 🥇

@mvanbeusekom
Copy link
Member

mvanbeusekom commented Nov 23, 2018

@naumanahmed19 which version of the plugin are you using? We had hopes that for the latest version (2.1.1) this is no longer necessary.

P.s. under the "Usage" paragraph (in the description) there is a note with a link that describes this issue.

@naumanahmed19
Copy link

naumanahmed19 commented Nov 23, 2018

I am using geolocator: ^2.1.0
https://pub.dartlang.org/packages/geolocator#-installing-tab-

I don't see 2.1.1 anywhere?

@surrenderios
Copy link

@Shentia
Copy link

Shentia commented Apr 12, 2019

Hi @hyz1992, no problem at all.

Now I see the problem and it can be solved quite easily. You will just have to update your Podfile which should be in the root of you ios folder. Simply add the following line to the post_install block:

config.build_settings['SWIFT_VERSION'] = '4.1'

The end result should look similar to this:

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

More information can be found here flutter/flutter#16049

It's Not work to me :(

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

5 participants