小编Jev*_*les的帖子

字典包含一定值swift 3

我想检查字典中的任何值中是否存在字符串

Dictionary<String, AnyObject>
Run Code Online (Sandbox Code Playgroud)

我知道数组有.contains所以我会认为字典也有.当我开始输入contains时,Xcode告诉我使用以下内容

countDic.contains(where: { ((key: String, value: AnyObject)) -> Bool in
            <#code#>
        })
Run Code Online (Sandbox Code Playgroud)

我只是不明白如何使用这个我知道里面我需要返回一个Bool,但我不明白我在哪里放什么String我正在寻找.任何帮助都会很棒.

dictionary swift3

8
推荐指数
1
解决办法
1万
查看次数

Firebase身份验证错误处理

不确定这是否已经存在,但我找不到它,所以我做到了.希望这能为某人提供帮助.您必须遵循的步骤:

步骤#1尝试登录后输入guard语句

步骤#2调用fireErrorHandle函数

就是这样,享受吧!

guard let error = AuthErrorCode(rawValue: (error?._code)!) else {
                    return
}
fireErrorHandle(code: error)

func fireErrorHandle(code: AuthErrorCode) {
    switch code {
    case .invalidCustomToken:
        print("Indicates a validation error with the custom token")
    case .customTokenMismatch:
        print("Indicates the service account and the API key belong to different projects")
    case .invalidCredential:
        print("Indicates the IDP token or requestUri is invalid")
    case .userDisabled:
        print("Indicates the user's account is disabled on the server")
    case .operationNotAllowed:
        print("Indicates the administrator disabled sign in with the …
Run Code Online (Sandbox Code Playgroud)

error-handling ios firebase firebase-authentication swift3

7
推荐指数
0
解决办法
1299
查看次数