无法将类型'()->()'的值转换为预期的参数类型'(((AuthDataResult ?, Error?)-> Void)?'

时间:2020-09-29 04:33:13

标签: swift xcode

static func signUp(username: String, email: String, password: String, imageData: Data, onSuccess: @escaping () -> Void, onError:  @escaping (_ errorMessage: String?) -> Void) {
        Auth().createUser(withEmail: email, password: password, completion: {            if error != nil {
                onError(error!.localizedDescription)
                return
            }
            let uid = user?.uid
            let storageRef = Storage.storage().reference(forURL: Config.STORAGE_ROOF_REF).child("profile_image").child(uid!)
            
            storageRef.put(imageData, metadata: nil, completion: { (metadata, error) in
                if error != nil {
                    return
                }

2 个答案:

答案 0 :(得分:0)

没有使用 public class UserAddress { public string Id { get; set; } public string Address1 { get; set; } public string Address2 { get; set; } public string ZipCode { get; set; } ' I don't know what to put here to connect this table with the AspNetUsers Table public int UserId {get;set} This doesn't work } 作为完成,因此您可以删除它,而我从您的代码中看到的是,您尝试将CREATE TABLE mytable( FROMDATE DATE NOT NULL ,TODATE DATE ); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('15/02/2016','30/04/2016'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('1/05/2016',NULL); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('2/06/2016','16/10/2016'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('17/10/2016','31/12/2016'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('1/01/2017','14/02/2017'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('15/02/2017','31/12/2017'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('1/01/2018','14/02/2018'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('15/02/2018','20/02/2018'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('21/02/2018','31/03/2018'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('1/04/2018','31/12/2018'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('1/01/2019','31/03/2019'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('1/04/2019','31/12/2019'); INSERT INTO mytable(FROMDATE,TODATE) VALUES ('1/01/2020',NULL); select fromdate , todate as todate_raw , coalesce(todate,lag(fromdate,1) over(order by fromdate DESC)) as todate_new from mytable order by fromdate 作为onSuccess接收。因此,我已经相应地更新了该代码。

Error

答案 1 :(得分:0)

Firebase Auth()。createUser中的完成块的签名为(((AuthDataResult ?, Error?)-> Void)?即它需要两个参数:结果和错误。您尚未包含任何内容,因此编译器假定您的完成块签名为()->()

通话的第一行应该是:

Auth().createUser(withEmail: email, password: password, completion: { result, error in 

例如参见https://stackoverflow.com/a/36586581/1852207