Error: No exact matches in reference to static method 'buildExpression'

Hello everyone, I'm just getting started with Swift and I'm in a bit of a knot here. Code below:

`if codeSent { TextField("6 Digit Code", text: $code)

                Divider()
                
                Button("Verify") {
                    print("verify...")
                    
                    if code.count == 6 {
                        cloud(fun: "customSmsAuth", cloudData: [
                            "code": code,
                            "phoneNumber": phoneNumber
                        ], completion: { resData in
                            let res = resData["res"] as? Int
                            
                            if res == 1 {
                                let customToken = resData["customToken"]
                                
                                Auth.auth().signIn(withCustomToken: customToken) { user, error in
                                    
                                    
                                }
                            } else {
                                print("An error occured...")
                            }
                        })
                    } else {
                        print("invalid code...")
                    }
                }.padding()
            }`

`else { HStack { Button("+26") { print("phone code...") }

                    TextField("Phone Number", text: $phoneNumber)
                }
                
                Divider()
                
                Button("Send Code") {
                    print("send code...")
                    
                    if phoneNumber.count == 10 {
                        cloud(fun: "sendSms", cloudData: ["phoneNumber" : "+26"+phoneNumber], completion: { resData in
                            let res = resData["res"] as? Int
                            
                            if res == 1 {
                                codeSent = true
                            } else {
                                print("An error occured...")
                            }
                        })
                    } else {
                        print("Invalid phone number...")
                    }
                    
                    print(phoneNumber)
                }.padding()
            }`

I'm trying to setup a simple phone based authentication with firebase. Any pointer where I'm going wrong will be appreciated.

Thanks.

Answered by Claude31 in 787011022

Please show complete code.

Where and how is customToken defined ? Is it an optional ?

If optional String, call should probably be:

Auth.auth().signIn(withCustomToken: customToken ?? "") { user, error in
  // some code
}

Please note that the code works just fine without lines 43 to 46.

Accepted Answer

Please show complete code.

Where and how is customToken defined ? Is it an optional ?

If optional String, call should probably be:

Auth.auth().signIn(withCustomToken: customToken ?? "") { user, error in
  // some code
}
Error: No exact matches in reference to static method 'buildExpression'
 
 
Q