2016-08-16 162 views
0

我正在尝试将Firebase后端集成到我的应用程序中。Swift2中的Firebase身份验证匿名

创建我podfile与

pod 'Firebase' 

一切都看起来很好用SDK进口

在我的第一个视图控制器我做的:

import Firebase 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     let ref = Firebase(url: "https://<YOUR-FIREBASE-APP>.firebaseio.com") 
ref.authAnonymouslyWithCompletionBlock { error, authData in 
      if error != nil { 
      // There was an error logging in anonymously 
      } else { 
      // We are now logged in 
      } 
     } 
    } 

但我得到了一个Can not call value of non-function type error

enter image description here

在此先感谢

+0

您正在使用哪个版本的Firebase ???? –

+0

在podfile我没有提到那 –

+2

所以最新的一个权利...比https://firebase.google.com/support/guides/firebase-ios –

回答

0

因此,他们已经改变了你荚安装火力地堡,现在不是仅仅增加荚“火力地堡”你必须添加个人荚这样的方式。

use_frameworks! 

    target “Your Project” do 
    pod 'Firebase/Core’ 
    pod 'Firebase/Database’ 
    pod 'Firebase/Auth’ 
end 

但是,您只需要放入'导入Firebase',它将覆盖与Firebase相关的所有Pod。别忘了在AppDelegate的didFinishLaunchingWithOptions方法中配置Firebase!

FIRApp.configure() 

祝您好运!