Search code examples
iosswiftobjective-cflutterfirebase

Could not build Objective-C module 'GTMSessionFetcher'


After upgrading to flutter latest version 3.7 and doing all packages upgrade. I am not able to build my project for iOS, for android its working fine.

Error Log

Swift Compiler Error (Xcode): Include of non-modular header inside framework module 'GTMSessionFetcher.GTMSessionFetcherLogging':
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcherLogging.h:15:8


Swift Compiler Error (Xcode): Duplicate interface definition for class 'GTMSessionFetcherUserDefaultsFactory'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:419:0


Swift Compiler Error (Xcode): Redefinition of 'GTMSessionFetcherError'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:429:27


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherErrorDownloadFailed'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:430:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherErrorUploadChunkUnavailable'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:431:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherErrorBackgroundExpiration'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:432:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherErrorBackgroundFetchFailed'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:433:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherErrorInsecureRequest'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:434:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherErrorTaskCreationFailed'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:435:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherErrorUserCancelled'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:439:2


Swift Compiler Error (Xcode): Redefinition of 'GTMSessionFetcherStatus'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:442:27


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherStatusNotModified'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:444:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherStatusBadRequest'
/ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:445:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherStatusUnauthorized'
ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:446:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherStatusForbidden'
ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:447:2


Swift Compiler Error (Xcode): Redefinition of enumerator 'GTMSessionFetcherStatusPreconditionFailed'
ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:448:2


Swift Compiler Error (Xcode): Reference to 'GTMSessionFetcherServiceProtocol' is ambiguous
Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:676:37


Swift Compiler Error (Xcode): Unknown class name 'GTMSessionFetcherServiceProtocol'; did you mean 'GTMSessionFetcherService'?
Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:676:37


Swift Compiler Error (Xcode): Type argument 'GTMSessionFetcherService' must be a pointer (requires a '*')
ios/Pods/GTMSessionFetcher/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h:676:37


Swift Compiler Error (Xcode): Too many errors emitted, stopping now


Swift Compiler Error (Xcode): Could not build Objective-C module 'GTMSessionFetcher'

I tried all solutions -

the latest version of the library installed.

all the necessary dependencies are installed and up-to-date.

Clean the build folder and then build the project again.

updating your pods and running 'pod install'.

deleting the derived data folder and build again.


Solution

  • Finally got the solution to it

    For me a xcode setting got changed while updating (i suppose)

    The errors are caused by changing the User Header Search Paths to: Pods/** (recursive)

    To remove the error we just need to delete it. So,

    • Go to General > Build Settings > Search User Header Search Paths > Delete Pods/**

    • Do flutter clean

    • Do flutter build ios

    Now You error should be gone

    Special Thanks and references to these links

    https://github.com/firebase/firebase-ios-sdk/issues/10726 https://github.com/lsamaria/GTMSessionFetcherIssue