简体   繁体   English

如何使用Swift将Firebase集成到iOS应用中?

[英]How to integrate Firebase in ios app using swift?

I want to integrate my app through firebase I follow this : https://firebase.google.com/docs/invites/ios but it shows me error of user must be sign in. 我想通过firebase集成我的应用程序,请按照以下步骤操作: https : //firebase.google.com/docs/invites/ios,但这表明我必须登录用户错误。

AppDeleget : AppDeleget:

@available(iOS 9.0, *)
    func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
        return self.application(application, open: url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, annotation: "")
    }

    internal func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {


        if GIDSignIn.sharedInstance().handle(url, sourceApplication: sourceApplication, annotation: annotation) {
            return true
        }

        return Invites.handleUniversalLink(url) { invite, error in
            // ...
        }

         return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
    }

My InviteVC 我的邀请

@IBAction func BtnActionInvtation(_ sender: Any) {

    if let invite = Invites.inviteDialog() {
        invite.setInviteDelegate(self)

        invite.setMessage("Try this app")
        // Title for the dialog, this is what the user sees before sending the invites.
        invite.setTitle("Invites Example")
        invite.setDeepLink("app_url")
        invite.setCallToActionText("Install!")
        invite.setCustomImage("https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png")
        invite.open()
    }

}

Change the rules in Firebase database rules if you are not asking user to sign in 如果您不要求用户登录,请更改Firebase数据库规则中的规则

{
  "rules": {
    ".read": "true",
    ".write": "auth != null"
  }
}

Firebase has clearly explained all the steps to integrate FirebaseInvites in iOS. Firebase清楚地说明了将FirebaseInvites集成到iOS中的所有步骤。 https://firebase.google.com/docs/invites/ https://firebase.google.com/docs/invites/

I think you don't read their documentation clearly. 我认为您没有清楚阅读其文档。 THey have mentioned you must sign in with Google account to invites your friends using FirebaseInvites. 有人提到您必须使用Google帐户登录才能使用FirebaseInvites邀请您的朋友。

If you need any help, please let me know. 如果您需要任何帮助,请告诉我。

Thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM