You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

引入Cloud Firestore后Flutter应用崩溃且CPU满载问题求助

解决Flutter引入cloud_firestore后iOS编译崩溃、CPU满载问题

修复步骤

1. 同步Flutter与依赖版本

  • 执行flutter upgrade升级到最新稳定版Flutter
  • 在pubspec.yaml中指定与当前Flutter版本兼容的cloud_firestore稳定版本,避免使用预发布版
  • 运行flutter pub get更新依赖

2. 清理iOS构建缓存

  • 删除ios目录下的Pods文件夹和Podfile.lock文件
  • 进入ios目录,执行pod deintegrate
  • 运行pod install --repo-update更新Pods仓库并重新安装依赖
  • 执行flutter clean清理Flutter缓存,再重新运行flutter run

3. 调整iOS部署目标

  • 打开ios目录下的Runner.xcworkspace,在Xcode中将Runner的Deployment Target设置为iOS 13.0或更高
  • 确保Podfile中的platform :ios, '13.0'与Xcode设置一致

4. 强制从源码编译gRPC

针对gRPC相关编译错误,在ios目录的Podfile中添加以下配置:

pod 'gRPC-Core', :git => 'https://github.com/grpc/grpc.git', :branch => 'v1.54.0'
pod 'gRPC-C++', :git => 'https://github.com/grpc/grpc.git', :branch => 'v1.54.0'

添加后重新执行pod install

5. 检查Xcode版本

确保使用最新稳定版Xcode,避免旧版本编译器的兼容性问题


错误日志片段:

Move<true>(absl::make_index_sequence<sizeof... (Ts)>0,
In file included from /Users/fscozano/Desktop/cicciofn/ios/Pods/gRPC-Core/src/core/lib/channel/promise_based_filter.cc:17:
In file included from /Users/fscozano/Desktop/cicciofn/ios/Pods/gRPC-Core/src/core/lib/channel/promise_based_filter.h:37:
In file included from /Users/fscozano/Desktop/cicciofn/ios/Pods/gRPC-Core/src/core/lib/channel/call_finalization.h:24:
In file included from /Users/fscozano/Desktop/cicciofn/ios/Pods/gRPC-Core/src/core/lib/channel/channel_stack.h: 72:
In file included from /Users/fscozano/Desktop/cicciofn/ios/Pods/gRPC-Core/src/core/lib/transport/transport.h: 60:
/Users/fscozano/Desktop/cicciofn/ios/Pods/gRPC-Core/src/core/lib/transport/metadata_batch.h: 1250:10: note: in instantiation of member function 'grpc_core:: Table<grpc_core::metadata_detail:: Value<grpc_core::HttpPathMetadata>, grpc_core::metadata_detail:: Value<grpc_core::HttpAuthorityMetadata>, grpc_core::metadata_detail:: Value<grpc_core::HttpMethodMetadata>, grpc_core::metadata_detail:: Value<grpc_core::HttpStatusMetadata>, grpc_core::metadata_detail:: Value<grpc_core::HttpSchemeMetadata>, grpc_core::metadata_detail:: Value<grpc_core::ContentTypeMetadata>, grpc_core::metadata_detail:: Value<grpc_core::TeMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcEncodingMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcInternalEncodingRequest>, grpc_core::metadata_detail:: Value<grpc_core::GrpcAcceptEncodingMetadata>, grpc_core::metadata_detail::Value<grpc_core::GrpcStatusMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcTimeoutMetadata>, grpc_core::metadata_detail::Value<grpc_core::GrpcPreviousRpcAttemptsMetadata>, grpc_core::metadata_detail::Value<grpc_core::GrpcRetryPushbackMsMetadata>, grpc_core::metadata_detail:: Value<grpc_core::UserAgentMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcMessageMetadata>, grpc_core::metadata_detail:: Value<grpc_core::HostMetadata>, grpc_core::metadata_detail:: Value<grpc_core::EndpointLoadMetricsBinMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcServerStatsBinMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcTraceBinMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcTagsBinMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcLbClientStatsMetadata>, grpc_core::metadata_detail:: Value<grpc_core::LbCostBinMetadata>, grpc_core::metadata_detail::Value<grpc_core::LbTokenMetadata>, grpc_core::metadata_detail:: Value<grpc_core::GrpcStreamNetworkState>, grpc_core::metadata_detail:: Value<grpc_core::PeerString>, grpc_core::metadata_detail:: Value<grpc_core::GrpcStatusContext>, grpc_core::metadata_detail:: Value<grpc_core::WaitForReady>>:: operator=' requested here
table_ = std::move(other.table_);

内容的提问来源于stack exchange,提问作者Francesco Zanoncelli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 03:22:27