2016-02-26 117 views
1

我正在用swift开发带有firebase的应用程序。 使用FDataSnapShot时出现错误。 这是我的代码。Swift:在使用Firebase SDK时使用未解析标识符“FDataSnapShot”

DataService.dataService.DATA_REF.observeEventType(.Value, withBlock: { 
     snapshot in 
     var newItems = [FDataSnapshot]() 

     // loop through the children and append them to the new array 
     for item in snapshot.children { 
      newItems.append(item as! FDataSnapshot) 
     } 

     // replace the old array 
     self.items = newItems 
    }) 

我用cocoapods安装了firebase sdk。 我的pod文件看起来像这样。

use_frameworks! 

pod 'Firebase' 
target 'nos' do 
end 

有没有人有这方面的经验? *注意:我正在使用最新版本的Xcode(7.2)。 我真的很希望能尽快听到你的消息。

+0

尝试在您的课程标题中添加“导入Firebase”。此外,请执行'ctrl + k'&'ctrl + b'清理缓存并重新构建您的新项目Firebase CocoaPod – Adrian

+0

对不起,它工作正常。 – AntonKolya

+0

我已经在应用程序委托中导入了Firebase,但它不起作用。 – AntonKolya

回答

3

如果你试图在一个UIViewController使用,确保你补充:

import Firebase 

YourViewController,清理缓存(ctrl+k)和重建(ctrl+b)您已经添加了CocoaPod后您的项目。

相关问题