TLDR

Run flutter clean.

Long version

I got this error when compiling my app for iOS. A quick search pointed me to https://github.com/FirebaseExtended/flutterfire/issues/1679 from Dec 2019. Apparently firebase_auth: ^0.15.3 doesn't compile in iOS? I'm on 0.15.4. They suggest to run pod update in the ios folder.

% pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AppAuth 1.4.0 (was 1.3.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing BoringSSL-GRPC 0.0.7 (was 0.0.3 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing Firebase 6.34.0 (was 6.12.0)
Installing FirebaseAnalytics 6.9.0 (was 6.1.5 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FirebaseAuth 6.9.2 (was 6.3.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FirebaseCore 6.10.4 (was 6.3.3 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FirebaseCoreDiagnostics 1.7.0 (was 1.1.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FirebaseFirestore 1.19.0 (was 1.7.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FirebaseInstallations (1.7.0)
Installing FirebaseStorage 3.9.1 (was 3.4.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing GTMAppAuth 1.1.0 (was 1.0.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing GTMSessionFetcher 1.4.0 (was 1.3.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing GoogleAppMeasurement 6.9.0 (was 6.1.5 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing GoogleDataTransport 7.5.1 (was 3.0.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing GoogleUtilities 6.7.2 (was 6.3.1)
Installing PromisesObjC (1.2.10)
Installing abseil (0.20200225.0)
Installing gRPC-C++ 1.28.2 (was 0.0.9 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing gRPC-Core 1.28.2 (was 1.21.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing nanopb 1.30906.0 (was 0.3.9011 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Removing FirebaseAuthInterop
Removing FirebaseCoreDiagnosticsInterop
Removing FirebaseInstanceID
Removing GoogleDataTransportCCTSupport
Removing Protobuf
Generating Pods project
Integrating client project
Pod installation complete! There are 14 dependencies from the Podfile and 37 total pods installed.

[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

I am not sure how these Flutter versions map to iOS CocoaPod versions. FirebaseAuth 6.9.2?... After this update, I try to compile, and this time the compile error is different:

% flutter build ios --release --no-codesign
Your Flutter application is created using an older version of the Android embedding. It's being deprecated in favor of Android embedding v2. Follow the steps on
https://flutter.dev/go/android-project-migration to migrate your project.

Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building [project name] for device (ios-release)...
Running pod install... 13.1s
Running Xcode build...

Xcode build done. 140.0s
Failed to build iOS app
Error output from Xcode build:

** BUILD FAILED **

Xcode's output:

[bunch of redacted warnings]

warning: Stale file
'project_folder/build/ios/Release-iphoneos/gRPC-Core/grpc.framework/PrivateHeaders/src/core/tsi/alts/handshaker/transport_security_common.pb.h' is
located outside of the allowed root paths.

project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.c:42:5: error: use of
undeclared identifier 'PB_LTYPE_BOOL'
    PB_FIELD( 25, BOOL    , OPTIONAL, STATIC  , OTHER, logs_proto_mobilesdk_ios_ICoreConfiguration, use_default_app, min_supported_ios_version, 0),
    ^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:534:9: note: expanded from macro 'PB_FIELD'
        PB_LTYPE_MAP_ ## type, ptr)
        ^
<scratch space>:71:1: note: expanded from here
PB_LTYPE_MAP_BOOL
^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:495:41: note: expanded from macro 'PB_LTYPE_MAP_BOOL'
#define PB_LTYPE_MAP_BOOL               PB_LTYPE_BOOL
                                        ^
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.c:43:5: error: use of
undeclared identifier 'PB_LTYPE_BOOL'
    PB_FIELD( 26, BOOL    , OPTIONAL, STATIC  , OTHER, logs_proto_mobilesdk_ios_ICoreConfiguration, deployed_in_app_store, use_default_app, 0),
    ^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:534:9: note: expanded from macro 'PB_FIELD'
        PB_LTYPE_MAP_ ## type, ptr)
        ^
<scratch space>:77:1: note: expanded from here
PB_LTYPE_MAP_BOOL
^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:495:41: note: expanded from macro 'PB_LTYPE_MAP_BOOL'
#define PB_LTYPE_MAP_BOOL               PB_LTYPE_BOOL
                                        ^
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.c:46:5: error: use of
undeclared identifier 'PB_LTYPE_BOOL'
    PB_FIELD( 29, BOOL    , OPTIONAL, STATIC  , OTHER, logs_proto_mobilesdk_ios_ICoreConfiguration, using_zip_file, apple_framework_version, 0),
    ^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:534:9: note: expanded from macro 'PB_FIELD'
        PB_LTYPE_MAP_ ## type, ptr)
        ^
<scratch space>:94:1: note: expanded from here
PB_LTYPE_MAP_BOOL
^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:495:41: note: expanded from macro 'PB_LTYPE_MAP_BOOL'
#define PB_LTYPE_MAP_BOOL               PB_LTYPE_BOOL
                                        ^
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.c:49:5: error: use of
undeclared identifier 'PB_LTYPE_BOOL'
    PB_FIELD( 33, BOOL    , OPTIONAL, STATIC  , OTHER, logs_proto_mobilesdk_ios_ICoreConfiguration, swizzling_enabled, platform_info, 0),
    ^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:534:9: note: expanded from macro 'PB_FIELD'
        PB_LTYPE_MAP_ ## type, ptr)
        ^
<scratch space>:111:1: note: expanded from here
PB_LTYPE_MAP_BOOL
^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:495:41: note: expanded from macro 'PB_LTYPE_MAP_BOOL'
#define PB_LTYPE_MAP_BOOL               PB_LTYPE_BOOL
                                        ^
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.c:50:5: error: use of
undeclared identifier 'PB_LTYPE_BOOL'
    PB_FIELD( 36, BOOL    , OPTIONAL, STATIC  , OTHER, logs_proto_mobilesdk_ios_ICoreConfiguration, using_gdt, swizzling_enabled, 0),
    ^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:534:9: note: expanded from macro 'PB_FIELD'
        PB_LTYPE_MAP_ ## type, ptr)
        ^
<scratch space>:117:1: note: expanded from here
PB_LTYPE_MAP_BOOL
^
In module 'nanopb' imported from
project_folder/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/Protogen/nanopb/firebasecore.nanopb.h:22:
project_folder/ios/Pods/nanopb/pb.h:495:41: note: expanded from macro 'PB_LTYPE_MAP_BOOL'
#define PB_LTYPE_MAP_BOOL               PB_LTYPE_BOOL
                                        ^
5 errors generated.

This time two posts refer to the same solution, which is to use pod deintegrate, followed by pod update. https://github.com/FirebaseExtended/flutterfire/issues/2507 and https://github.com/firebase/firebase-ios-sdk/issues/5548 from May 2020.

But after running them, I still get the same errors. Another suggestion is to do a Clean Build Folder.

This time the previous errors disappeared and I got 5 new ones:

<module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORDataFuture.h' [-Werror,-Wincomplete-umbrella]
#import "Headers/GoogleDataTransport-umbrella.h"
^
<module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORPrioritizer.h' [-Werror,-Wincomplete-umbrella]
<module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORStoredEvent.h' [-Werror,-Wincomplete-umbrella]
<module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORUploadPackage.h' [-Werror,-Wincomplete-umbrella]
4 errors generated.
In file included from [project_folder]/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m:20:
[project_folder]/ios/Pods/FirebaseCoreDiagnostics/GoogleDataTransport/GDTCORLibrary/Internal/GoogleDataTransportInternal.h:18:9: fatal error: could
not build module 'GoogleDataTransport'
#import <GoogleDataTransport/GoogleDataTransport.h>
	~~~~~~~^
5 errors generated.

For the first error, I found this post: https://github.com/firebase/firebase-ios-sdk/issues/3934 from Sept 2019. That also says that some state is stale, and I should run rm -rf ~/Library/Developer/Xcode/DerivedData/. This command is also mentioned in some of the previous posts I mentioned earlier, but it looked the hackiest. Fine. Let's try it.

After deleting that folder and compiling, same errors. Now according to this post (https://github.com/flutter/flutter/issues/41383#issuecomment-535689716), this person tried 3 clean up methods, and it eventually worked. The only one I haven't tried yet is flutter clean. Last hope.

% flutter clean
Cleaning Xcode workspace...                                         5.7s
Deleting build...                                                4,417ms (!)
Deleting .dart_tool...                                              34ms
Deleting Generated.xcconfig...                                       1ms
Deleting flutter_export_environment.sh...                            1ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         2ms

While it's building... This post assembled a bunch of Pod related clean up commands. Eventually I'll have to read in detail what each of them does.

And... it compiled! I really should have tried flutter clean from the start. Lesson learned.