使用Firebase时使用未解析的标识符“FIRDatabase” [英] Use of unresolved identifier 'FIRDatabase' when using Firebase

查看:169
本文介绍了使用Firebase时使用未解析的标识符“FIRDatabase”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode告诉我, FIRDatabase 不是标识符。
我的代码:

 导入UIKit 
导入Firebase

@UIApplicationMain
class AppDelegate:UIResponder,UIApplicationDelegate {

var window:UIWindow?

func application(application:UIApplication,didFinishLaunchingWithOptions launchOptions:[NSObject:AnyObject]?) - > Bool {
FIRApp.configure()
FIRDatabase.database()。persistenceEnabled = true //使用未解析的标识符FIRDatabase'
return true
}
}

我正在使用:
$ b Xcode 7.2。 1,
Firebase 3.0.2,
OSX 10.10.5



Podfile内容:

  source'https://github.com/CocoaPods/Specs.git'
platform:ios,'8.0'
use_frameworks!

target'myapp'do
pod'IQKeyboardManagerSwift','< = 4.0.0'
pod'JSQMessagesViewController','< = 7.3.1'
pod'Firebase'
end


解决方案

您需要添加

  pod'Firebase / Database'

到您的pod文件,如此处所述

https://firebase.google.com/docs/database/ios/start



您可以找到哪个窗格包含哪个功能
Pods and Features
p>

Xcode tells me that FIRDatabaseis not an identifier. My code:

import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        FIRApp.configure()
        FIRDatabase.database().persistenceEnabled = true // Use of unresolved identifier 'FIRDatabase'
        return true
    }
}

I am using:

Xcode 7.2.1, Firebase 3.0.2, OSX 10.10.5

Podfile content:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target 'myapp' do
pod 'IQKeyboardManagerSwift', '<= 4.0.0'
pod 'JSQMessagesViewController', '<= 7.3.1'
pod 'Firebase'
end

解决方案

You need to add

  pod 'Firebase/Database'

to your pod file as explained here

https://firebase.google.com/docs/database/ios/start

Here you can find which pod includes which feature Pods and Features

这篇关于使用Firebase时使用未解析的标识符“FIRDatabase”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆