Error setting up Firebase in Xcode

丶灬走出姿态 提交于 2019-12-12 20:35:09

问题


I have tried to set up Firebase to work on Xcode using both the quick setup instructions and the manual alternate instructions on Firebase website.

When I used CocoaPods and followed the instructions on the quick setup page, I was able to import Firebase, but I was not able to reference Firebase inside the class. I got the error: Cannot call value of non-function type 'module' xcode

When I tried to set it up manually, I was not able to import or reference Fire base and I got the error: No such module 'Firebase'


回答1:


I had the same issue when updating my project to the new version of Firebase. A TON of changes were announced at Google I/O and thus there is a good amount of updating to be done.

It sounds like you might be using the old version of Firebase with the new SDK. You should do everything with Firebase 3.0. Hence var rootRef = Firebase(url:"https://<YOUR-FIREBASE-APP>.firebaseio.com") will now be var rootRef = FIRDatabase.database().reference().

Take a look at the setup guide at: https://firebase.google.com/docs/ios/setup#prerequisites (be sure you aren't looking at the legacy docs!). If you want to convert code from the old version of Firebase to 3.0, check out the Upgrading tutorial: https://firebase.google.com/support/guides/firebase-ios#get_a_database_reference_numbered




回答2:


You should try to manually edit your podfile to something like:

use_frameworks!

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

I use these directives to get it working with Xcode 7.3.



来源:https://stackoverflow.com/questions/37355824/error-setting-up-firebase-in-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!