GVKun编程网logo

使用Swift 3.0查询Firebase(swift查询网址)

11

以上就是给各位分享使用Swift3.0查询Firebase,其中也会对swift查询网址进行解释,同时本文还将给你拓展Firebase配置失败–Swift、IOSSwiftSwiftUIFirebas

以上就是给各位分享使用Swift 3.0查询Firebase,其中也会对swift查询网址进行解释,同时本文还将给你拓展Firebase配置失败 – Swift、IOS Swift SwiftUI Firebase “未找到默认存储桶您是否正确配置了 Firebase 存储?”、ios – Firebase 3.6.0(Auth) – 使用Swift 3.0检测特定错误、ios – Firebase重置密码Swift等相关知识,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

使用Swift 3.0查询Firebase(swift查询网址)

使用Swift 3.0查询Firebase(swift查询网址)

我正在尝试获取createdAt等于的所有条目Today,但是它什么也不返回。

我在这里做错了什么?而且,以我尝试的方式查询数据的正确方法是什么?

JSON:

    {      "thoughts" : {        "-KWGdcdZD8QJSLx6rSy8" : {          "createdAt" : "Tomorrow",          "thought" : "meno",          "user" : "ET9tYfHqThNTsLG4bZGIbuLGauu2"        },        "-KWGeGivZl0dH7Ca4kN3" : {          "createdAt" : "Today",          "thought" : "meno",          "user" : "ET9tYfHqThNTsLG4bZGIbuLGauu2"        },        "-KWGeIvWHBga0VQazmEH" : {          "createdAt" : "Yesterday",          "thought" : "meno",          "user" : "ET9tYfHqThNTsLG4bZGIbuLGauu2"        }      }    }

迅速:

    let db = FIRDatabase.database().reference().child("thoughts")    let ref = db.queryEqual(toValue: "Today", childKey: "createdAt")    ref.observe(.value, with:{ (snapshot: FIRDataSnapshot) in        for snap in snapshot.children {            print((snap as! FIRDataSnapshot).key)        }    })

答案1

小编典典

您需要使用queryOrderedByChildto,createdAt而不是使用equalToToday

let ref = FIRDatabase.database().reference().child("thoughts").queryOrdered(byChild: "createdAt").queryEqual(toValue : "Today")ref.observe(.value, with:{ (snapshot: FIRDataSnapshot) in    for snap in snapshot.children {        print((snap as! FIRDataSnapshot).key)    }})

Firebase配置失败 – Swift

Firebase配置失败 – Swift

在我的应用程序中,我成功使用了Firebase,在AppDelegate中我进行了设置:
// ### Initialize Firebase
FIRApp.configure()

现在我对相关目标进行一些单元测试,当我启动它时,我得到错误:

2017-04-14 14:53:22.351 MyProject[28753] <Error> [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
2017-04-14 14:53:22.354 MyProject[28753] <Error> [Firebase/Messaging][I-IID001000] Firebase is not set up correctly. Sender ID is nil or empty.
2017-04-14 14:53:22.356 MyProject[28753] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3800000 started
2017-04-14 14:53:22.356 MyProject[28753] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2017-04-14 14:53:22.381 MyProject[28753:712475] *** Terminating app due to uncaught exception 'com.firebase.instanceid',reason: 'Could not configure Firebase InstanceID. Google Sender ID must not be nil or empty.'

版本:

Firebase/Core (3.16.0)
Firebase/Messagging (3.16.0)

任何建议?

我刚刚注意到它开始发生在我身上,我的travis版本因Firebase 3.16而失败。我降级到3.7.1,这是我以前在项目中的版本,它再次运行。

我没有时间去研究它,但这是一个快速修复。它可能是Firebase错误,或者它们可能已经改变了某些内容,现在设置也不同了。

编辑:显然回滚到3.15工作得很好。

IOS Swift SwiftUI Firebase “未找到默认存储桶您是否正确配置了 Firebase 存储?”

IOS Swift SwiftUI Firebase “未找到默认存储桶您是否正确配置了 Firebase 存储?”

通过将其与 Firebase 项目断开连接并将其重新连接到新的 Firebase 项目来解决该问题。另外重新下载 firebase .plist 文件可能已经完成了(确保将 .plist 文件添加回 xcode 时,它​​的名称末尾没有 (2) 或 (3)。否则 xcode 获胜不认识它。)还添加了“Firebase/Analytics”吊舱,不确定如何,但这可能有所帮助。希望这对正在寻找解决方案的人有所帮助。

ios – Firebase 3.6.0(Auth) – 使用Swift 3.0检测特定错误

ios – Firebase 3.6.0(Auth) – 使用Swift 3.0检测特定错误

我正在尝试找出如何检测某个错误.假设登录失败,我想检查错误是否说输入的帐户不存在,然后告诉观众.如果可能的话,所有其他错误也是如此.

在Parse中,我会检查error.code是否等于某个数字,不确定它是否与Firebase相同或类似.

解决方法

用这个:-
if let errCode = FIRAuthErrorCode(rawValue: err!._code) {

                switch errCode {
                case .errorCodeInvalidEmail:
                    print("invalid email")
                case .errorCodeEmailAlreadyInUse:
                    print("in use")
                default:
                    print("Other error!")
                }

            }

其中err是来自firebase的错误

ios – Firebase重置密码Swift

ios – Firebase重置密码Swift

我想知道你们是否可以告诉我如何在 Swift中设置重置密码,我目前正在使用Firebase作为我的后端服务.我只需要代码.

解决方法

答案是在 API documentation:

-sendPasswordResetWithEmail:completion:

Initiates a password reset for the given email address.

See 07001 for a list of error codes that are common to all API methods.

在Swift 3.x和Firebase 3.x中,它看起来像这样:

FIRAuth.auth()?.sendPasswordReset(withEmail: "email@email") { error in
    // Your code here
}

编辑:

Firebase 4将Firebase功能更改为与Swift中的命名约定更加一致.

Auth.auth().sendPasswordReset(withEmail: "email@email") { error in
    // Your code here
}

今天关于使用Swift 3.0查询Firebaseswift查询网址的讲解已经结束,谢谢您的阅读,如果想了解更多关于Firebase配置失败 – Swift、IOS Swift SwiftUI Firebase “未找到默认存储桶您是否正确配置了 Firebase 存储?”、ios – Firebase 3.6.0(Auth) – 使用Swift 3.0检测特定错误、ios – Firebase重置密码Swift的相关知识,请在本站搜索。

本文标签: