Flutter iOS build warnings - flutter

When I try to archive my flutter product for release I am getting lot of warnings as shown below.
Minimum deployment iOS version: 12
Xcode version: 14.2
My POD file for installation as below:
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['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end

You have to change this line in your podfile at root/ios/Podfile to the desired target version.
Then you'd ideally reinstall all pods or do a repo update
Happy coding :)

Related

Signing for "GoogleSignIn-GoogleSignIn" requires a development team

After updating to Xcode 14 I'm getting the following error:
Signing for "GoogleSignIn-GoogleSignIn" requires a development team. Select a development team in the Signing & Capabilities editor.`
I've tried doing pod update but it doesn't work.
I had the same issue after switching to Xcode 14. Add this to your podfile and call pod install. This will permanently fix the issue.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
end
From the target POD Select
GoogleSignIn-GoogleSignIn
then go to the team drop list and select your team
Add this to your podfile and call pod install
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_DEVELOPMENT_TEAM_ID'
end
end
end
end
I recommend you update to the latest React Native version (at time of writing: v0.70.3) to get their fix (https://github.com/facebook/react-native/issues/34673) for the code signing change to XCode14
You can check your latest react native package version with yarn list --pattern react-native in your project root
After updating either:
update ios/Podfile with the following
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_DEVELOPMENT_TEAM_ID'
end
end
end
end
where YOUR_DEVELOPMENT_TEAM_ID is replaced with the actual value
or
Manually go through the pods failing the build and select your development team and re-attempt building.
For me, for my flutter project after upgrading my Xcode:
Open ios->Podfile
Remove the function from "post_install"
Add the below code.
Note: Do not forget to change your Development Team Code.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_DEVELOPMENT_CODE'
end
end
end
end

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

CocoaPods. The iOS deployment target IPHONE_DEPLOYMENT_TARGET

I have a host of CocoaPods that all throwing this warning:
The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99.
anyway to correct these?
Would converting to Swift Packages help, and if so is there a way to tell if a Pod has a swift package?
Thanks all,
In the pod file at the end, you can use this to set the minimum os version for each of your pods to a specific version and then run pod install command from terminal. This will change deployment target version.
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end

Migrating to CocoaPods 1.1.1 with WatchKit Extension

I am trying to migrate to the latest version of CocoaPods from 0.39. Here is my original podfile:
platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
pod 'SwiftyJSON'
pod 'Alamofire', '~> 4.0'
pod 'AlamofireImage', '~> 3.1'
end
target 'MyAppWatchKitApp' do
end
target 'MyAppWatchKitApp Extension' do
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
After reading the CocoaPods 1.0 Migration Guide and this StackOverflow post I tried updating my podfile:
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
pod 'SwiftyJSON'
pod 'Alamofire', '~> 4.0'
pod 'AlamofireImage', '~> 3.1'
target 'MyAppWatchKitApp' do
end
target 'MyAppWatchKitApp Extension' do
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
Saving the podfile, running pod update in Terminal, then opening and building the project, I see the following error (client name censored, replace with "MyApp" to match pod files above):
Other things I've tried:
Doing a pod install in addition to pod update
Deleting derived data
I have some good experience with Swift and Xcode but pods are still relatively new to me. Maybe I'm missing something very basic. Any help is greatly appreciated!
Add this line to your post install step in the Podfile.
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'

Can't migrate to 3.0 pods libraries

I use Kanna and Reachability libraries. And seems they already migrated to swift 3. I use Cocoapods:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'MyProj' do
pod 'Kanna', '~> 2.0.0'
pod 'ReachabilitySwift', '~> 3'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
Got error when do import:
import Kanna
import ReachabilitySwift
Module compiled with Swift 2.3 cannot be imported in Swift 3.0
Flag: Use legacy swift versions everywhere set to No
Found solution here. Need to delete rm -rf ~/Library/Developer/Xcode/DerivedData/ This folder was cached.