Fixing Classes/Launcher.swift:22:1: type 'UIApplication' does not conform to protocol 'Launcher'

Today I upgraded flutter flutter upgrade, then compiled my Flutter app to iOS. It failed with this error:

Classes/Launcher.swift:22:1: type 'UIApplication' does not conform to protocol 'Launcher'

After searching for the error, I found https://github.com/flutter/flutter/issues/151467 as the first result. It turns out it is a known issue that has been fixed. The latest comment suggests upgrading dependencies by running flutter pub upgrade.

After which it told me I now was using url_launcher 6.3.1, which is the latest version according to pub.dev.

Yet when I tried to compile again, it told me this

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * changed the constraints of dependency `GoogleSignIn` inside your development pod `google_sign_in_ios`.
   You should run `pod update GoogleSignIn` to apply changes you've made.

and then that:

❌  /Users/anhtuan/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.5/ios/Classes/Launcher.swift:22:1: type 'UIApplication' does not conform to protocol 'Launcher'

So I tried running those commands:

% cd ios
ios % pod repo update

Weird:

ios % pod repo update
Updating spec repo `trunk`
[!] CDN: trunk Repo update failed - 43 error(s):
CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/CocoaPods-version.yml Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_0_3_5.txt Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_0_6_a.txt Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_0_7_e.txt Response: Timeout was reached
Was it a temporary network issue?
ios % pod repo update
Updating spec repo `trunk`

CocoaPods 1.15.0 is available.
To update use: `sudo gem install cocoapods`

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.15.0

anhtuan@MacMini ios % sudo gem install cocoapods
Password:
Fetching cocoapods-1.15.2.gem
Fetching concurrent-ruby-1.3.4.gem
Fetching cocoapods-core-1.15.2.gem
Successfully installed concurrent-ruby-1.3.4
Successfully installed cocoapods-core-1.15.2
Successfully installed cocoapods-1.15.2
Parsing documentation for concurrent-ruby-1.3.4
Installing ri documentation for concurrent-ruby-1.3.4
Parsing documentation for cocoapods-core-1.15.2
Installing ri documentation for cocoapods-core-1.15.2
Parsing documentation for cocoapods-1.15.2
Installing ri documentation for cocoapods-1.15.2
Done installing documentation for concurrent-ruby, cocoapods-core, cocoapods after 3 seconds
3 gems installed
anhtuan@MacMini ios % pod repo update           
Updating spec repo `trunk`
anhtuan@MacMini ios % pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "GoogleSignIn":
  In snapshot (Podfile.lock):
    GoogleSignIn (= 7.0.0, ~> 7.0)

  In Podfile:
    google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) was resolved to 0.0.1, which depends on
      GoogleSignIn (~> 7.1)


You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * changed the constraints of dependency `GoogleSignIn` inside your development pod `google_sign_in_ios`.
   You should run `pod update GoogleSignIn` to apply changes you've made.
anhtuan@MacMini ios % pod install --repo-update
Updating local specs repositories
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "GoogleSignIn":
  In snapshot (Podfile.lock):
    GoogleSignIn (= 7.0.0, ~> 7.0)

  In Podfile:
    google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) was resolved to 0.0.1, which depends on
      GoogleSignIn (~> 7.1)


You have either:
 * changed the constraints of dependency `GoogleSignIn` inside your development pod `google_sign_in_ios`.
   You should run `pod update GoogleSignIn` to apply changes you've made.
anhtuan@MacMini ios % 

To be honest, I don't really care about the lock file.

rm Podfile.lock
pod install
cd ..
./build.sh

...
Running Xcode build...                                                  
Xcode archive done.                                         28.5s
Failed to build iOS app
Error (Xcode): unsupported option '-G' for target 'arm64-apple-ios9.0'


Encountered error while archiving for device.

Is there no end to errors? What's going on?

❌  /Users/anhtuan/git/elysium_mobile_client/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:73:12: value of optional type '(any StorageProvider)?' must be unwrapped to refer to member 'storage' of wrapped base type 'any StorageProvider'

    return provider.storage(for: Storage.bucket(for: app))
           ^



❌  /Users/anhtuan/git/elysium_mobile_client/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:88:12: value of optional type '(any StorageProvider)?' must be unwrapped to refer to member 'storage' of wrapped base type 'any StorageProvider'

    return provider.storage(for: Storage.bucket(for: app, urlString: url))
           ^



❌  /Users/anhtuan/git/elysium_mobile_client/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:291:39: cannot assign value of type '(any AuthInterop)?' to type 'any AuthInterop'

    auth = ComponentType<AuthInterop>.instance(for: AuthInterop.self,
           ^



❌  /Users/anhtuan/git/elysium_mobile_client/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/Storage.swift:293:47: cannot assign value of type '(any AppCheckInterop)?' to type 'any AppCheckInterop'

    appCheck = ComponentType<AppCheckInterop>.instance(for: AppCheckInterop.self,
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It turns out this error dates back from March 2024:

🐛 [firebase_storage] Swift Compiler Error (Xcode): Value of optional type StorageProvider must be unwrapped · Issue #12429 · firebase/flutterfire
Bug report Describe the bug Xcode build error on Flutter project Swift Compiler Error (Xcode): Value of optional type ‘(any StorageProvider)?’ must be unwrapped to refer to member ‘storage’ of wrap...
If you're using firebase dependencies you can upgrade them as follow(whichever you're using right now)

firebase_analytics: 10.8.9
firebase_auth: 4.17.8
firebase_core: 2.27.0
firebase_crashlytics: 3.4.18
firebase_messaging: 14.7.19
firebase_storage: 11.6.9

then flutter clean and pod install. Should work

Here's what my pubspec.yaml looks like:

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: ^4.2.0
  firebase_auth: ^4.2.1
  firebase_core: ^2.4.0
  firebase_messaging: ^14.1.4
  firebase_storage: ^11.0.8

Here's what it looks like after upgrading:

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: ^4.2.0
  firebase_auth: ^4.17.8
  firebase_core: ^2.27.0
  firebase_messaging: ^14.7.19
  firebase_storage: ^11.6.9

Let's run the commands to update

% flutter clean
Cleaning Xcode workspace...                                         3.1s
Cleaning Xcode workspace...                                         4.1s
Deleting build...                                                  437ms
Deleting .dart_tool...                                             955ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
Deleting Flutter.podspec...                                          0ms
Deleting ephemeral...                                                0ms
Deleting ephemeral...                                                1ms
Deleting ephemeral...                                                0ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         0ms
anhtuan@MacMini elysium_mobile_client % cd ios
anhtuan@MacMini ios % pod install

[!] Invalid `Podfile` file: /Users/anhtuan/git/elysium_mobile_client/ios/Flutter/Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first.

 #  from /Users/anhtuan/git/elysium_mobile_client/ios/Podfile:16
 #  -------------------------------------------
 #    unless File.exist?(generated_xcode_build_settings_path)
 >      raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
 #    end
 #  -------------------------------------------
anhtuan@MacMini ios % 

Ugh alright:

ios % cd ..
anhtuan@MacMini elysium_mobile_client % flutter pub get
Resolving dependencies... 
Downloading packages... 
  _fe_analyzer_shared 72.0.0 (76.0.0 available)
  _flutterfire_internals 1.3.7 (1.3.44 available)
  analyzer 6.7.0 (6.11.0 available)
  cloud_firestore 4.9.3 (5.4.4 available)
  cloud_firestore_platform_interface 5.16.2 (6.4.3 available)
  cloud_firestore_web 3.7.2 (4.3.2 available)
  collection 1.18.0 (1.19.0 available)
  fake_cloud_firestore 2.4.1+1 (3.0.3 available)
  firebase_auth 4.10.1 (5.3.1 available)
  firebase_auth_mocks 0.12.0 (0.14.1 available)
  firebase_auth_platform_interface 6.19.1 (7.4.7 available)
  firebase_auth_web 5.8.2 (5.13.2 available)
  firebase_core 2.17.0 (3.6.0 available)
  firebase_core_platform_interface 4.8.0 (5.3.0 available)
  firebase_core_web 2.8.0 (2.18.1 available)
  firebase_messaging 14.6.9 (15.1.3 available)
  firebase_messaging_platform_interface 4.5.8 (4.5.46 available)
  firebase_messaging_web 3.5.8 (3.9.2 available)
  firebase_storage 11.2.8 (12.3.3 available)
  firebase_storage_mocks 0.6.1 (0.7.0 available)
  firebase_storage_platform_interface 4.4.7 (5.1.31 available)
  firebase_storage_web 3.6.8 (3.10.3 available)
  flutter_launcher_icons 0.13.1 (0.14.1 available)
  geocoding 2.2.2 (3.0.0 available)
  geocoding_ios 2.3.0 (3.0.1 available)
  geolocator 10.1.1 (13.0.1 available)
  geolocator_android 4.3.1 (4.6.1 available)
  geolocator_web 2.2.1 (4.1.1 available)
  http_parser 4.0.2 (4.1.0 available)
  intl 0.18.1 (0.19.0 available)
  js 0.6.7 (0.7.1 available)
  leak_tracker 10.0.5 (10.0.7 available)
  leak_tracker_flutter_testing 3.0.5 (3.0.8 available)
  macros 0.1.2-main.4 (0.1.3-main.0 available)
  material_color_utilities 0.11.1 (0.12.0 available)
  meta 1.15.0 (1.16.0 available)
  mime 1.0.6 (2.0.0 available)
  more 3.10.2 (4.3.0 available)
  rx 0.1.3 (0.4.0 available)
  rxdart 0.27.7 (0.28.0 available)
  stack_trace 1.11.1 (1.12.0 available)
  string_scanner 1.2.0 (1.3.0 available)
  test_api 0.7.2 (0.7.3 available)
  uuid 3.0.7 (4.5.1 available)
  vm_service 14.2.5 (14.3.0 available)
Got dependencies!
45 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
anhtuan@MacMini elysium_mobile_client % cd ios
anhtuan@MacMini ios % pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '10.15.0' defined in 'firebase_core'
Downloading dependencies
Installing AppAuth (1.7.5)
Installing BoringSSL-GRPC (0.0.24)
Installing Firebase (10.15.0)
Installing FirebaseAppCheckInterop (10.29.0)
Installing FirebaseAuth (10.15.0)
Installing FirebaseAuthInterop (10.29.0)
Installing FirebaseCore (10.15.0)
Installing FirebaseCoreExtension (10.29.0)
Installing FirebaseCoreInternal (10.29.0)
Installing FirebaseFirestore (10.15.0)
Installing FirebaseInstallations (10.29.0)
Installing FirebaseMessaging (10.15.0)
Installing FirebaseStorage (10.15.0)
Installing Flutter (1.0.0)
Installing GTMAppAuth (4.1.1)
Installing GTMSessionFetcher (3.5.0)
Installing GoogleDataTransport (9.4.1)
Installing GoogleSignIn (7.1.0)
Installing GoogleUtilities (7.13.3)
Installing PromisesObjC (2.4.0)
Installing RecaptchaInterop (100.0.0)
Installing abseil (1.20220623.0)
Installing cloud_firestore (4.9.3)
Installing firebase_auth (4.10.1)
Installing firebase_core (2.17.0)
Installing firebase_messaging (14.6.9)
Installing firebase_storage (11.2.8)
Installing flutter_native_timezone (0.0.1)
Installing gRPC-C++ (1.50.1)
Installing gRPC-Core (1.50.1)
Installing geocoding_ios (1.0.5)
Installing geolocator_apple (1.2.0)
Installing google_sign_in_ios (0.0.1)
Installing image_picker_ios (0.0.1)
Installing leveldb-library (1.22.5)
Installing nanopb (2.30909.1)
Installing url_launcher_ios (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 12 dependencies from the Podfile and 37 total pods installed.

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
anhtuan@MacMini ios % 

Now the only error in red left is this:

▸ Touching FirebaseCoreInternal_Privacy.bundle (in target 'FirebaseCoreInternal-FirebaseCoreInternal_Privacy' from project 'Pods')

❌  error: unsupported option '-G' for target 'arm64-apple-ios9.0' (in target 'BoringSSL-GRPC' from project 'Pods')


▸ Compiling tls_record.cc

❌  clang: error: unsupported option '-G' for target 'arm64-apple-ios9.0'

This error was reported in June. https://github.com/grpc/grpc/issues/36888

My Podfile.lock states that I am on this version:

BoringSSL-GRPC (0.0.24):

The solutions posted in the thread do not really apply to me. They suggest patching out the -G parameter in the Podfile. This is ugly and I am certainly not copy/pasting this in each and every one of my projects.

A further search brought me to this: they give the versions of firebase that worked for them:

firebase_core: 3.6.0
firebase_auth: 5.3.1
cloud_firestore: 5.4.4
firebase_messaging: 15.1.3
firebase_storage: 12.3.3
cloud_functions: 5.1.3
BoringSSL-GRPC unsupported option ‘-G’ for target ‘arm64-apple-ios15.0’
After updating to the XCode 16 Beta, when building app i get this error (in attachments), thats basically it. Is there any way to fix that or should I wait for BoringSSL update?I’ve tried pod upda...

I am on different major versions... Let's just update everything to the latest version.

% flutter pub upgrade --major-versions
Resolving dependencies... (1.5s)
Changed 12 constraints in pubspec.yaml:
  cloud_firestore: ^4.2.0 -> ^5.4.4
  firebase_auth: ^4.2.1 -> ^5.3.1
  firebase_core: ^2.4.0 -> ^3.6.0
  firebase_messaging: ^14.1.4 -> ^15.1.3
  firebase_storage: ^11.0.8 -> ^12.3.3
  geolocator: ^10.1.0 -> ^13.0.1
  intl: ^0.18.0 -> ^0.19.0
  geocoding: ^2.1.0 -> ^3.0.0
  fake_cloud_firestore: ^2.1.0 -> ^3.0.3
  firebase_auth_mocks: ^0.12.0 -> ^0.14.1
  firebase_storage_mocks: ^0.6.0+1 -> ^0.7.0
  flutter_launcher_icons: ^0.13.1 -> ^0.14.1
Resolving dependencies... 
Downloading packages... (1.3s)
  _fe_analyzer_shared 72.0.0 (76.0.0 available)
> _flutterfire_internals 1.3.44 (was 1.3.7)
  analyzer 6.7.0 (6.11.0 available)
> cloud_firestore 5.4.4 (was 4.9.3)
> cloud_firestore_platform_interface 6.4.3 (was 5.16.2)
> cloud_firestore_web 4.3.2 (was 3.7.2)
  collection 1.18.0 (1.19.0 available)
> fake_cloud_firestore 3.0.3 (was 2.4.1+1)
> firebase_auth 5.3.1 (was 4.10.1)
> firebase_auth_mocks 0.14.1 (was 0.12.0)
> firebase_auth_platform_interface 7.4.7 (was 6.19.1)
> firebase_auth_web 5.13.2 (was 5.8.2)
> firebase_core 3.6.0 (was 2.17.0)
> firebase_core_platform_interface 5.3.0 (was 4.8.0)
> firebase_core_web 2.18.1 (was 2.8.0)
> firebase_messaging 15.1.3 (was 14.6.9)
> firebase_messaging_platform_interface 4.5.46 (was 4.5.8)
> firebase_messaging_web 3.9.2 (was 3.5.8)
> firebase_storage 12.3.3 (was 11.2.8)
> firebase_storage_mocks 0.7.0 (was 0.6.1)
> firebase_storage_platform_interface 5.1.31 (was 4.4.7)
> firebase_storage_web 3.10.3 (was 3.6.8)
> flutter_launcher_icons 0.14.1 (was 0.13.1)
> geocoding 3.0.0 (was 2.2.2)
> geocoding_ios 3.0.1 (was 2.3.0)
> geolocator 13.0.1 (was 10.1.1)
> geolocator_android 4.6.1 (was 4.3.1)
> geolocator_web 4.1.1 (was 2.2.1)
  http_parser 4.0.2 (4.1.0 available)
> intl 0.19.0 (was 0.18.1)
> js 0.7.1 (was 0.6.7)
  leak_tracker 10.0.5 (10.0.7 available)
  leak_tracker_flutter_testing 3.0.5 (3.0.8 available)
  macros 0.1.2-main.4 (0.1.3-main.0 available)
  material_color_utilities 0.11.1 (0.12.0 available)
  meta 1.15.0 (1.16.0 available)
  mime 1.0.6 (2.0.0 available)
> more 4.2.0 (was 3.10.2) (4.3.0 available)
> rx 0.4.0 (was 0.1.3)
> rxdart 0.28.0 (was 0.27.7)
+ sprintf 7.0.0
  stack_trace 1.11.1 (1.12.0 available)
  string_scanner 1.2.0 (1.3.0 available)
  test_api 0.7.2 (0.7.3 available)
> uuid 4.5.1 (was 3.0.7)
  vm_service 14.2.5 (14.3.0 available)
Changed 32 dependencies!
15 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
anhtuan@MacMini elysium_mobile_client % 

Then ran the usual flutter clean and others:

% pod repo update
Updating spec repo `trunk`
anhtuan@MacMini ios % pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
Downloading dependencies
Installing AppAuth (1.7.5)
Installing BoringSSL-GRPC (0.0.36)
Installing Firebase (11.2.0)
Installing FirebaseAppCheckInterop (11.3.0)
Installing FirebaseAuth (11.2.0)
Installing FirebaseAuthInterop (11.3.0)
Installing FirebaseCore (11.2.0)
Installing FirebaseCoreExtension (11.3.0)
Installing FirebaseCoreInternal (11.3.0)
Installing FirebaseFirestore (11.2.0)
Installing FirebaseFirestoreInternal (11.2.0)
Installing FirebaseInstallations (11.3.0)
Installing FirebaseMessaging (11.2.0)
Installing FirebaseSharedSwift (11.3.0)
Installing FirebaseStorage (11.2.0)
Installing Flutter (1.0.0)
Installing GTMAppAuth (4.1.1)
Installing GTMSessionFetcher (3.5.0)
Installing GoogleDataTransport (10.1.0)
Installing GoogleSignIn (7.1.0)
Installing GoogleUtilities (8.0.2)
Installing PromisesObjC (2.4.0)
Installing RecaptchaInterop (100.0.0)
Installing abseil (1.20240116.2)
Installing cloud_firestore (5.4.4)
Installing firebase_auth (5.3.1)
Installing firebase_core (3.6.0)
Installing firebase_messaging (15.1.3)
Installing firebase_storage (12.3.3)
Installing flutter_native_timezone (0.0.1)
Installing gRPC-C++ (1.65.5)
Installing gRPC-Core (1.65.5)
Installing geocoding_ios (1.0.5)
Installing geolocator_apple (1.2.0)
Installing google_sign_in_ios (0.0.1)
Installing image_picker_ios (0.0.1)
Installing leveldb-library (1.22.5)
Installing nanopb (3.30910.0)
Installing url_launcher_ios (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 12 dependencies from the Podfile and 39 total pods installed.

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
anhtuan@MacMini ios % 

Finally it got the newer version. And it seems to compile fine.