Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

huangapple go评论64阅读模式
英文:

Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

问题

我在flutter上开发一个应用程序,在尝试在xcode上构建我的应用程序时遇到了错误。我得到了这样的错误:

Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

以下是我得到的大部分错误:

> 使用未声明的标识符'FIRAnalytics'

这是我使用的技术:

Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

我不知道该如何处理这个错误,这是我第一次在flutter上使用firebase,当我为android构建时没有问题。

有人能告诉我我需要做什么来解决这个问题吗?

英文:

I was working an app on flutter and got error when I tried to build my app on xcode. I got error like this :

Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

Here's the most error I get

> Use of undeclared identifier 'FIRAnalytics'

And here is the technology I used :

Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

Firebase Analytics on Xcode got error FIRAnalytics and FIRConsent undeclared identifier

I don't know what should I do with this error, this is my first time using firebase on flutter and there is no problem when I build for android.

Can someone tell me what I need to do to solve this?

答案1

得分: 1

我遇到了相同的问题,在我的情况下,与我使用的Min Dart SDK版本有关。请检查您的版本,并确保您正在使用的所有firebase库与您已安装的Dart SDK版本匹配。

  1. 检查pubspec.yaml文件中的environment.sdk以检查SDK约束(我的是>=2.14.0 <3.0.0)。
  2. 获取实际的依赖项列表:dart pub deps
  3. 对于每个firebase依赖项,请访问https://pub.dev/。
  4. 按名称搜索依赖项。
  5. 打开“版本”选项卡,查看“Min Dart SDK”列。
  6. 检查库版本是否在所述步骤范围内。

这是我的pubspec.yaml中的firebase依赖项:

firebase_core: 2.11.0
firebase_remote_config: ^3.0.15
firebase_analytics: ^10.1.6

为了避免出现最新版本(在我的情况下,这就是引发Analytics问题的原因),firebase_core依赖项需要保持不变。

英文:

I stumbled in the same issue and, in my case, it was related to the Min Dart SDK version I was using. Please check yours and be sure that all the firebase libraries you are using match the Dart SDK version you have installed.

  1. Check pubspec.yaml environment.sdk check SDK contraints (mine were &gt;=2.14.0 &lt;3.0.0)
  2. Get the actual list of dependencies: dart pub deps
  3. For each firebase dependency go to https://pub.dev/
  4. Search dependency by name
  5. Open the "Versions" tab and look at the column "Min Dart SDK"
  6. Check if the library version is within the range of the step

These are my firebase dependencies in pubspec.yaml:

firebase_core: 2.11.0
firebase_remote_config: ^3.0.15
firebase_analytics: ^10.1.6

The firebase_core dependency needs to stay fixed to avoid getting the latest (that was the one that cause the issue with Analytics, in my case)

huangapple
  • 本文由 发表于 2023年7月6日 22:27:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/76629877.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定