2016-02-26 77 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後您的項目。

相關問題