Flutter iOS build fail on running pod install
Fixed by updating flutter and CocoaPods to the latest version and then run following command
flutter cleanrm -Rf ios/Podsrm -Rf ios/.symlinksrm -Rf ios/Flutter/Flutter.frameworkrm -Rf ios/Flutter/Flutter.podspec
Got the issue. when we create a plugin by command on the terminal it creates a plugin with default Java for Android and Objective-C for iOS. It can be changed to Kotlin for Android and Swift for iOS by using a command, but it will add support to only android/
and ios/
in the root folder. This does not change the example code in example/
directory. The provided examples are still in Java for Android and Objective-C for iOS. So then I created a plugin from Android Studio, I created a Swift support for iOS by checking an option 'Include Swift support for ios code', it created an example with swift instead of Objective-C. Then the issue is solved.
You need to set your Swift Version since flutter_plugin did not specify a Swift version by default
In your ios/Podfile
add
config.build_settings['SWIFT_VERSION'] = '4.1' # required by simple_permission
In the following manner:
target 'Runner' do use_frameworks! # required by simple_permission ...endpost_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 endend
You may also check out this github thread and this stackoverflow discussion for further details regarding why this occurred.