iOS - Firebase错误:使用未解析的标识符FIRApp运行提供的代码

时间:2016-05-19 15:58:50

标签: ios firebase

尝试配置XCode以使用Firebase 3时,使用安装文档中的代码会给我一个错误:

https://firebase.google.com/docs/ios/setup#add_the_sdk

null

15 个答案:

答案 0 :(得分:43)

我认为这是正确的解决方案:

  1. pod repo update
  2. pod update
  3. 但我遇到了同样的问题并解决了它在命令行上执行以下步骤:

    1. pod repo update
    2. 评论了我的Podfile中的pod 'Firebase'
    3. pod install(这删除了旧的Firebase)
    4. 再次添加pod 'Firebase'行。
    5. pod install(添加了新的Firebase)
    6. 第二步和第三步是我认为的关键,否则CocoaPods没有尝试更新它。正如我所说,也许这可以通过pod update解决,但现在我不能再回去再试一次。

      在完成所有这些之后你应该看到类似的东西: Installing Firebase (3.2.0) Installing FirebaseAnalytics (3.2.0) Installing FirebaseInstanceID (1.0.6) Installing GoogleInterchangeUtilities (1.2.1) Installing GoogleSymbolUtilities (1.1.1) Installing GoogleUtilities (1.3.1)

答案 1 :(得分:14)

我有同样的错误,很容易解决。关闭项目。打开pod文件,然后从

更新

pod 'Firebase', '>= 2.5.1'

pod 'Firebase/Core'
pod 'Firebase/Database'

然后打开位于项目文件夹中pod文件的终端,输入:pod update。确保你看到2行

Installing Firebase 3.2.0 (was 2.5.1)
Installing FirebaseDatabase (3.0.1)

然后你很高兴

答案 2 :(得分:10)

像这样解决这个问题:

import FirebaseAnalytics

然后需要将FIRApp替换为FirebaseApp,因为FIRApp已被弃用。

感谢。

答案 3 :(得分:8)

在终端中更新您的广告连播类型

pod update

然后安装pod agian,为我工作

答案 4 :(得分:5)

尝试再次使用pod repo updatepod install

答案 5 :(得分:4)

我遇到了同样的问题,我就这样解决了。

pod update ...

(仅使用Firebase / Core和Analytics)

enter image description here

我正在使用xCode版本8.2.1 希望这对某人有所帮助。

如果项目较旧且其他豆荚有问题, 您只能更新所需的广告连播: How to update a single pod without touching other dependencies

答案 6 :(得分:2)

首先确保您的Firebase版本为3 通过使用控制台输入您的项目文件 并使用pod更新顺序将Firebase版本更新为3

答案 7 :(得分:2)

尝试从podfile中删除pod,然后执行'pod install'。添加回来然后再做一个'pod install'。清理工作区,然后构建它。它花了我几次尝试,但最终为我工作。

答案 8 :(得分:2)

如果您使用ReactNative> 0.62,请确保输入public function up() { Schema::create('users', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('email')->unique()->nullable(); $table->string('telephone')->nullable(); $table->date('daten')->nullable(); $table->string('autreh')->nullable(); $table->boolean('is_admin')->default(0); $table->string('autrei')->nullable(); $table->string('adressem')->nullable(); $table->string('adresser')->nullable(); $table->string('image')->nullable(); $table->text('images')->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); }

AppDelegate.m

之前:

#import <Firebase.h>

答案 9 :(得分:1)

我刚刚将Firebase.configure()更改为FIRApp.configure()

寒意:)

答案 10 :(得分:0)

所有其他答案都是现货,但听起来你已经覆盖了那些东西。确保您使用的是CocoaPods 1.0(或更高版本)并在Podfile中指定了use_frameworks!

如果要进行升级,首先要清除我们的Pods /目录,并可能运行pod deintegrate以恢复到零状态。

答案 11 :(得分:0)

事实证明,hoangpx答案是修复bug的正确方法,更改pod模块的名称有帮助。但请记住,当您尝试运行pod安装时,它会出现(或者如果还没有修复的话):

Note: as of Cocoapods 1.0 ‘pod repo update’ does not happen on ‘pod install’ by default.

意味着您应首先pod Firebase update更新到版本3.2.0及更高版本pod install

答案 12 :(得分:0)

将cocoapods更新到1.0.x版,然后pod install解决了我的问题

pod --version(查看当前版本)

答案 13 :(得分:0)

在我使用离子Cordova插件的情况下,我刚刚添加:

#import "FIRApp.h"

到CDVGoogleAnalytics.m文件

答案 14 :(得分:0)

在AppDelegate.m文件中,导入以下行:#import <Firebase.h>行之前的#ifdef FB_SONARKIT_ENABLED