无法将模块“fireBaseDatabase”加载为“FirebaseDatabase”

时间:2017-06-13 20:54:03

标签: swift firebase module firebase-realtime-database

所以我是Firebase的新手,我正在关注如何将你的Swift应用程序连接到Firebase的这个人教程,这对他来说完全没问题。但是当我尝试导入'FirebaseDatabase'时,它会给我这个错误;

无法将模块'fireBaseDatabase'加载为'FirebaseDatabase

我想知道如何解决这个问题。谢谢。

这是我的podfile;

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'FIRBaseQuickStart' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for FIRBaseQuickStart

    pod ‘Firebase’
    pod ‘Firebase/Database’

end

当我尝试运行应用程序时,它说“线程1:信号SIGABRT”。

import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        FirebaseApp.configure()

        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}

它给出了类声明行的错误。这太令人沮丧了。

2 个答案:

答案 0 :(得分:0)

如果您使用的是Firebase的最新版本(4.0),则只需使用import Firebase,因为我已从文档中了解到这一点。

对于数据库引用:

var ref: DatabaseReference!

ref = Database.database().reference()

你可以找到它here

试试吧。希望它有所帮助。

答案 1 :(得分:0)

事实证明,这是因为项目名称。我把它作为'fireBaseDatabase',结果证明复杂化了。我刚刚用另一个名字创建了另一个项目,现在没关系!