升级Flutter3.7后iOS构建失败:无法编译GTMSessionFetcher模块
Flutter 3.7升级后iOS构建失败:无法构建Objective-C模块'GTMSessionFetcher'
将项目升级至Flutter 3.7最新版本并完成所有依赖包更新后,Android端可正常构建,但iOS端构建失败,核心错误为无法构建Objective-C模块'GTMSessionFetcher',具体编译错误日志如下:
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'
已尝试但无效的解决方案
- 安装最新版本的GTMSessionFetcher库
- 确保所有必要依赖已安装并更新至最新版本
- 清理构建文件夹后重新构建
- 更新Pods并执行
pod install - 删除Derived Data文件夹后重新构建
内容的提问来源于stack exchange,提问作者Gaurav bhiwaniwala
相关产品推荐
相关产品推荐

