I usually debug my Flutter apps using the Android Emulator. This time, I used the iOS Simulator. Except it threw this error:

    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /my_project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'GTMAppAuth' from project 'Pods')
    /my_project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'FMDB' from project 'Pods')
    /my_project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'BoringSSL-GRPC' from project 'Pods')
    /my_project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    /my_project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 13.

Opening the project in XCode, I can see that the Runner Target and Project are already set to targetting iOS 10.0:

Pods too:

But GoogleSignIn is indeed still set to 8.0:

If I tap Ctrl+A, it lets me individually select versions:

If I Cmd+Tap Pods to unselect it, I can now batch select the Deployment Target:

Before I do anything rash, let's check out what others have to say about it. Let's read this: https://stackoverflow.com/questions/63973136/the-ios-deployment-target-iphoneos-deployment-target-is-set-to-8-0-in-flutter.

In another, simpler project, it threw this error:

Launching lib/main.dart on iPhone 13 in debug mode...
lib/main.dart:1
Project base configurations detected, removing.
Upgrading contents.xcworkspacedata
Updating minimum iOS deployment target from 8.0 to 9.0.
Upgrading project.pbxproj
Upgrading AppFrameworkInfo.plist
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Warning: Podfile is out of date
  This can cause issues if your application depends on plugins that do not support iOS or macOS.
  See https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms for details.
  If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/45197 for instructions.
To regenerate the Podfile, run:

  rm ios/Podfile

Error launching application on iPhone 13.
Exited (sigterm)

Seems like a simple way to update the Podfile. However it doesn't work in my current project.

Another trick, delete the lock files and download the Pods again.

Running "flutter pub get" in flashcards...
Launching lib/main.dart on iPhone 13 in debug mode...
CocoaPods' output:
↳
      Preparing
    Analyzing dependencies
    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
    cloud_firestore: Using Firebase SDK version '8.9.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_analytics` from `.symlinks/plugins/firebase_analytics/ios`
    firebase_analytics: Using Firebase SDK version '8.9.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
    firebase_auth: Using Firebase SDK version '8.9.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    firebase_core: Using Firebase SDK version '8.9.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_storage` from `.symlinks/plugins/firebase_storage/ios`
    firebase_storage: Using Firebase SDK version '8.9.0' defined in 'firebase_core'
    -> Fetching podspec for `flutter_sound` from `.symlinks/plugins/flutter_sound/ios`
    -> Fetching podspec for `flutter_tts` from `.symlinks/plugins/flutter_tts/ios`
    -> Fetching podspec for `google_sign_in` from `.symlinks/plugins/google_sign_in/ios`
    -> Fetching podspec for `path_provider_ios` from `.symlinks/plugins/path_provider_ios/ios`
    -> Fetching podspec for `permission_handler` from `.symlinks/plugins/permission_handler/ios`
    -> Fetching podspec for `share` from `.symlinks/plugins/share/ios`
    -> Fetching podspec for `shared_preferences_ios` from `.symlinks/plugins/shared_preferences_ios/ios`
    -> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/ios`
    -> Fetching podspec for `url_launcher_ios` from `.symlinks/plugins/url_launcher_ios/ios`
    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_0_3_5.txt exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/8.6.0/Firebase.podspec.json exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path downloaded: all_pods_versions_d_a_7.txt, save ETag: W/"61c3dcfa-4a9"
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/d/a/7/flutter_sound_core/8.4.0+3/flutter_sound_core.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/d/a/7/flutter_sound_core/8.4.0+3/flutter_sound_core.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/d/a/7/flutter_sound_core/8.4.0+4/flutter_sound_core.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/d/a/7/flutter_sound_core/8.4.0+4/flutter_sound_core.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/d/a/7/flutter_sound_core/8.4.1/flutter_sound_core.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/d/a/7/flutter_sound_core/8.4.1/flutter_sound_core.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/d/a/7/flutter_sound_core/8.4.2/flutter_sound_core.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/d/a/7/flutter_sound_core/8.4.2/flutter_sound_core.podspec.json
      CDN: trunk Relative path downloaded: Specs/d/a/7/flutter_sound_core/8.4.0+4/flutter_sound_core.podspec.json, save ETag: W/"35a-6TMwocZXk2EbLilkXkvurjrQBfI"
      CDN: trunk Relative path downloaded: Specs/d/a/7/flutter_sound_core/8.4.0+3/flutter_sound_core.podspec.json, save ETag: W/"35a-fXAWo+KKGs5pQO5v4mj/Ecrg9Ec"
      CDN: trunk Relative path downloaded: Specs/d/a/7/flutter_sound_core/8.4.1/flutter_sound_core.podspec.json, save ETag: W/"356-vE9jvB7zM3G3CVE6Lj6ft6CfB7s"
      CDN: trunk Relative path downloaded: Specs/d/a/7/flutter_sound_core/8.4.2/flutter_sound_core.podspec.json, save ETag: W/"356-VaFmXn74zblaud0GWBx0bdnJbkg"
      CDN: trunk Relative path: Specs/d/a/7/flutter_sound_core/8.4.2/flutter_sound_core.podspec.json modified during this run! Returning local
      CDN: trunk Relative path downloaded: all_pods_versions_0_7_e.txt, save ETag: W/"61c3dcf9-333"
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/2.1/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/2.1/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/2.1.1/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/2.1.1/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/2.2/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/2.2/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/3.0/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/3.0/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.2.2/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.2.2/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.2.2.LTS/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.2.2.LTS/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.2.LTS/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.2.LTS/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.3/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.3/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.3.1/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.3.1/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.3.1.LTS/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.3.1.LTS/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.3.2/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.3.2/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.4/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.4/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.4.LTS/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.4.LTS/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/3.1/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/3.1/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.2/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.2/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/0/7/e/mobile-ffmpeg-audio/4.2.1/mobile-ffmpeg-audio.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/0/7/e/mobile-ffmpeg-audio/4.2.1/mobile-ffmpeg-audio.podspec.json
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.3.2/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6d0-HAA9CRgZW7pMIWKdVD5E5LXh5C0"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.2.2/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6ac-A/RpypTYTvO86UQIzekiNztXHU4"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.2.2.LTS/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6b8-ZLJXMthJ6Tn80RxrTBD/M44yCMg"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.3.1.LTS/mobile-ffmpeg-audio.podspec.json, save ETag: W/"688-rcNgR7gDK8D45cTmq3yxEBidmzc"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.2.LTS/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6af-BvMrvSLRLU5k28QYXwJrf/upN/g"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.2.1/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6aa-gDIM8asiazA7X3PUQB7GDwK3Hiw"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/2.1/mobile-ffmpeg-audio.podspec.json, save ETag: W/"4a3-u2RPJOXTVBvnOknVWImkMBB8PAo"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.3.1/mobile-ffmpeg-audio.podspec.json, save ETag: W/"67c-XdZ5WnSC7ElT+v4+WxXqHCGmUFs"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.4.LTS/mobile-ffmpeg-audio.podspec.json, save ETag: W/"679-HgoFP4pt5XEU5Q/0izqF/xxg+QI"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.2/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6a3-/ZiLwobpjTtsniqxRFpira5C0O8"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/2.2/mobile-ffmpeg-audio.podspec.json, save ETag: W/"4a1-Ns4n+oHszbvhgYvaXnQDV9B5I5o"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.4/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6d7-pca7Ho401JMYjM2RiLQmI0CbLu8"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/3.0/mobile-ffmpeg-audio.podspec.json, save ETag: W/"51b-rzGjAVxfB5lGS48l8Mh1BMG7zKk"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/2.1.1/mobile-ffmpeg-audio.podspec.json, save ETag: W/"4a9-7lBFTyvAm/boey5jqjhXaVu/sr4"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/4.3/mobile-ffmpeg-audio.podspec.json, save ETag: W/"6a3-sIfndYnn0MHQTX8rWBq4XcKQXUk"
      CDN: trunk Relative path downloaded: Specs/0/7/e/mobile-ffmpeg-audio/3.1/mobile-ffmpeg-audio.podspec.json, save ETag: W/"515-C5as3rBiA/H5IDOUMkdGiOPER8c"
      CDN: trunk Relative path: Specs/0/7/e/mobile-ffmpeg-audio/4.4/mobile-ffmpeg-audio.podspec.json modified during this run! Returning local
      CDN: trunk Relative path: all_pods_versions_d_4_0.txt exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/d/4/0/GoogleSignIn/6.0.1/GoogleSignIn.podspec.json exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_f_4_e.txt exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/f/4/e/FMDB/2.7.5/FMDB.podspec.json exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/7/e/mobile-ffmpeg-audio/4.4.LTS/mobile-ffmpeg-audio.podspec.json modified during this run! Returning local
    [!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
      In Podfile:
        firebase_core (from `.symlinks/plugins/firebase_core/ios`) was resolved to 1.10.6, which depends on
          Firebase/CoreOnly (= 8.9.0)
    None of your spec sources contain a spec satisfying the dependency: `Firebase/CoreOnly (= 8.9.0)`.
    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * mistyped the name or version.
     * not added the source repo that hosts the Podspec to your Podfile.
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:257:in `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1074:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update
Error running pod install
Error launching application on iPhone 13.
Exited (sigterm)

Running pod repo update also fails because of ffi. Looking back at my previous post http://blog.wafrat.com/fixing-ios-compile-issues-in-flutter/, on M1, I should install ffi like this:

% sudo arch -x86_64 gem install ffi
Password:
Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Fetching ffi-1.15.4.gem
Building native extensions. This could take a while...
Successfully installed ffi-1.15.4
Parsing documentation for ffi-1.15.4
Installing ri documentation for ffi-1.15.4
Done installing documentation for ffi after 8 seconds
1 gem installed 

But even after this, pod update fails. Let's try the pristine command they mention.

% sudo arch -x86_64 gem pristine ffi --version 1.15.0   
Password:
Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Restoring gems to pristine condition...
Building native extensions. This could take a while...
Restored ffi-1.15.0

Now it complains about only version 1.14.2:

Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2

So I ran the same command for version 1.14.2. Finally, pod repo update returned this error:

### Error

LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/ffi_c.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:5:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:2:in `<top (required)>'
...
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Let's try to make sense of what happened. I installed ffi 1.15.4 for x86 with Rosetta. And it looks like someone somewhere wants the native version. Google led me to this post on StackOverflow and the most voted for answer is this: https://stackoverflow.com/a/65334677. On top of installing ffi with Rosetta, you should run pod repo update with Rosetta as well: arch -x86_64 pod repo update. This time it does not throw an error:

% arch -x86_64 pod repo update 
Updating spec repo `trunk`

CocoaPods 1.11.0.beta.2 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

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

The third most upvoted answer (https://stackoverflow.com/a/66556339) advises to install an M1 compatible version of Ruby instead, which supposedly is the native way of doing things, arch -x86_64 being just a workaround. I'll definitely have to try that later.

Now after also running an update of my project dependencies to major versions, the compilation for iOS returns:

`GoogleAppMeasurement` requires CocoaPods version `>= 1.10.2`, which is not satisfied by your current version, `1.10.1`.

Let's update pod then.

% sudo gem install cocoapods
Password:
Fetching cocoapods-core-1.11.2.gem
Fetching molinillo-0.8.0.gem
Fetching rexml-3.2.5.gem
Fetching xcodeproj-1.21.0.gem
Fetching cocoapods-1.11.2.gem
Successfully installed cocoapods-core-1.11.2
Successfully installed molinillo-0.8.0
Successfully installed rexml-3.2.5
Successfully installed xcodeproj-1.21.0
Successfully installed cocoapods-1.11.2
Parsing documentation for cocoapods-core-1.11.2
Installing ri documentation for cocoapods-core-1.11.2
Parsing documentation for molinillo-0.8.0
Installing ri documentation for molinillo-0.8.0
Parsing documentation for rexml-3.2.5
Installing ri documentation for rexml-3.2.5
Parsing documentation for xcodeproj-1.21.0
Installing ri documentation for xcodeproj-1.21.0
Parsing documentation for cocoapods-1.11.2
Installing ri documentation for cocoapods-1.11.2
Done installing documentation for cocoapods-core, molinillo, rexml, xcodeproj, cocoapods after 2 seconds
5 gems installed

Now if I try to compile to iOS, it works fine.

Building com.company.my_app for device (ios-release)...
Running pod install...                                             25.6s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        12.7s
Xcode build done.                                           285.3s
Built /Users/anhtuan/git/flashcards/build/ios/iphoneos/Runner.app.

But if I compile to iOS for the Emulator, it fails with this error:

Launching lib/main.dart on iPhone 13 in debug mode...
Xcode build done.                                            2.0s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[10364]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1facc6b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10668c2c8). One of the two will be used. Which one is undefined.
    objc[10364]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1facc6be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10668c318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    the_app/ios/Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')
    /the_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    /the_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

It might be thanks to the major dependency upgrades I did earlier, but now there are only 2 projects left which have the wrong deployment target version. Enough to change them manually without fearing to make a mistake.

Let's fix those. Another problem solved, another error shows up!

Launching lib/main.dart on iPhone 13 in debug mode...
Xcode build done.                                            2.0s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[12195]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1facc6b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105f1c2c8). One of the two will be used. Which one is undefined.
    objc[12195]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1facc6be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105f1c318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /the_app/ios/Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

A search leads me to this ticket: https://developer.apple.com/forums/thread/660782. It seems like my issue except the architectures are reversed. So let's exclude x86_64 from my build for the iOS Simulator.

Now the error seems to disappear and compilation goes further, but somehow the target iOS versions of GoogleSignIn and AppAuth are reverted back to 8.0.0:

Launching lib/main.dart on iPhone 13 in debug mode...
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Xcode build done.                                            2.0s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[13538]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1facc6b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1044b02c8). One of the two will be used. Which one is undefined.
    objc[13538]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1facc6be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1044b0318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /my_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    /my_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')
    /my_app/ios/Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

And that, ladies and gentlemen, is the long story of how I did NOT manage to run my app in the iOS Simulator.

The effort is not worth the trouble, since I can easily run the project in the Android Emulator. If the works well in Android, I am nearly assured it will work well on iOS once it's deployed too.

Installing the new Ruby

Coming back after a few days to try again. Using this post, which I had mentioned above, I install Ruby:

% which ruby
/usr/bin/ruby
% brew install ruby
[...install complete logs]
If you need to have ruby first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
% echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
** launch a new terminal window **
% which ruby
/opt/homebrew/opt/ruby/bin/ruby

Installing CocoaPods:

pod --version
1.11.2
% sudo gem install cocoapods
[some logs]
% pod --version             
1.11.2 # same version

Looks like CocoaPods was already at the latest version. Then I uninstalled the x64 version of ffi, ran pod install, then tried again and got this:

Launching lib/main.dart on iPhone 13 in debug mode...
Xcode build done.                                            2.0s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[58130]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1dc2e6b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1085c42c8). One of the two will be used. Which one is undefined.
    objc[58130]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1dc2e6be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1085c4318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/anhtuan/git/flashcards/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    /Users/anhtuan/git/flashcards/ios/Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')
    /Users/anhtuan/git/flashcards/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

This time this error is gone:

'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')

Might we be making some progress? Let's set the SDK versions from 8.0 to 9.0 for the two libraries.

... Nope, when I set the two libraries to 9.0, I get this error again:

[app path]/ios/Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64. (in target 'Runner' from project 'Runner')

This time I went into XCode, target Runner in project Runner and checked the values.

Added x86_64 to the excluded architectures for Debug

This time this seems to have done something. It compiled for much longer and ended up with new errors:

Launching lib/main.dart on iPhone 13 in debug mode...
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Xcode build done.                                           97.8s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[60013]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1dc2e6b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10628c2c8). One of the two will be used. Which one is undefined.
    objc[60013]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1dc2e6be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10628c318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    [app path]/ios/Pods/gRPC-C++/src/core/lib/security/credentials/credentials.h:208:3: note: type is given name 'grpc_credentials_mdelem_array' for linkage purposes by this typedef declaration
    } grpc_credentials_mdelem_array;
      ^
    1 warning generated.
    Failed to package [app path].
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    note: Removed stale file 
...
    warning: None of the architectures in ARCHS (arm64, x86_64, i386) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (arm64, arm64e, i386, x86_64) which is not in EXCLUDED_ARCHS (i386, arm64, x86_64). (in target 'Runner' from project 'Runner')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'FMDB' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'leveldb-library' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'abseil' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'BoringSSL-GRPC' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'gRPC-Core' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'gRPC-C++' from project 'Pods')
    [app path]/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

Ok, so now I'll try the Podfile config change, the loop which forces the deployment target to be 9.0 for IPHONEOS_DEPLOYMENT_TARGET. I went from:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

To:

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['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
  end
end

Another suggestion in a comment to this answer was to simply delete the config instead of setting the value to '9.0'.

Now the error is:

warning: None of the architectures in ARCHS (arm64, x86_64, i386) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (arm64, arm64e, i386, x86_64) which is not in EXCLUDED_ARCHS (i386, arm64, x86_64). (in target 'Runner' from project 'Runner')
Removed arm64 from Debug's excluded architectures.

Now I'm getting:

ld: warning: ignoring file /[app path]/build/ios/Debug-iphonesimulator/google_sign_in/google_sign_in.framework/google_sign_in, building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64

Should I flutter clean again?

... Cleaning and compiling again did not fix the error.

So I kept searching until finally I found this:

Flutter iOS App on an iOS Simulator running on an M1 Mac
Is there an issue with Flutter iOS apps on an iOS simulator (iPhone 12 Pro Max) running on an M1 Mac with Big Sur 11.2.2 and Flutter 1.22.6 ? You see, my Flutter iOS app (using multiple Flutter plu...

Apparently Flutter does not work on the iOS Simulator on an M1 Mac. The PR in question has been merged. So maybe we'll be able to do it soonish? Now I know that I shouldn't look further.