Flutter ios build fails in xcode 10.1 with swift_version - flutter

I'm building a flutter app. everyting worked just fine. Then I think dart was upgraded and suddenly the build of the app fails with this error:
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.
I don't see the setting in xcode and not sure what caused this error. Anyone else seen it?

For anyone else looking for the solution. You need to have XCode version higher than 10.0 before you can use Swift 4.2.
Open your podfile and make the following changes
target 'Runner' do
use_frameworks! # <---- // 1st add this right below above line
...
end
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.2' # <--- // 2nd add this
end
end
end
After this, in terminal use flutter run. More info

Related

Cannot find type 'PiPViewCoordinator' in scope

I am getting following error when i install JitsiMeetSDK in flutter but i am unable to run app. Can somebody suggest me how can i resolve this issue?
I am using following:
Xcode : 13.1
Swift : 5
jitsi_meet: ^4.0.0
Android Studio Bumblebee
Note: Example compilable with XCode 12.2
then -->
Add this line in Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
I've ran into the same problem. I tried building the application on iOS Simulator and it keeps getting swift compile errors of all sorts. I followed Usama solution above and it worked for me.
I'm using
MacBook M1
Xcode 14.2
Flutter 3.7.1
Android Studio 2022.1 Electric Eel

Xcode 13 and Cocoapods, how to disable assertions?

I want to disable assertions to avoid asserts failures from third part libraries installed with Cocoapods also for the debug phase, not only release.
To reach this goal I've disabled Enable Foundation Assertions from my project section as showed in this image:
and for my target section:
For Pods I've changed my Podfile adding to the bottom part before the end statement this code:
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['ENABLE_NS_ASSERTIONS'] = 'NO'
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_NS_ASSERTIONS'] = 'NO'
end
end
end
When I open my project workspace on Xcode , I see that also Pods project section and all target section have the same parameter turned to NO for both debug and release.
Now I'm in DEBUG mode with my simulator, when I launch my app assertions still works and my app still stops to assertion failure:
assert(false,"warning, change your file name with this...")
Are there any other parameters to turn off that I have forgotten?
P.S.:
Xcode 13 final version (13A233)
Cocoapods v1.11.2

No such module 'module X' on Xcode 12.2 only on Simulator

I have recently updated my Xcode to version 12.2 and my macOS to version 11.0.1 Big Sur . My project will successfully when I select my actual device but when I select a Simulator it starts showing this error
No such module as 'X'
Of course rebuilding and deleting DrivedData and pod install ... not worked.
where is the problem?
it has no issue runnig on my actual device.
Just add this piece of code at the end of your PodFile and you are good to go
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end

Unsupported swift version (SWIFT 5)

before you mark this question as a duplicate, I checked this question
and it didn't work for me.
how to fix this error:
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'DropDown')
For XCode 10.1, select your Pods File
-> Go to Build Settings -> Choose your Pod -> Search "Swift" -> Navigate to "Swift Language version" -> Set to desired language version.
You have code which was compiled on the new Xcode 10.2 or the beta version which supports Swift 5. Update your Xcode to the latest version.
After upgrading to Xcode 10.2 release make sure you reboot MacOS. I had the exact same problem and reboot helped.
In addition to the correct answer, I added this to my podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
end
end
end

Swift compile errors FileBrowser, swift 2.3

I am trying to debug my beta, which worked really fine before iOS 10, Swift 3. and I don't see the end.
I cannot build it. My app is in Swift 2.3 (Xcode 8)
I have an error with the Library FileBrowser version 0.1.4
I add on Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
But I am still having a compile error with the library FileBrowser
error:
Type of previewItemURL' has different optionality than required by protocol 'QLPreviewItem' PreviewManager.swift
Well the library FileBrowser doesn't support Swift 2.3 only swift 3.
Two choices:
- Change library for browsing file
- Switch all the project to swift 3