cuốn sách gpt4 ai đã làm

Lỗi: Đối số được truyền cho cuộc gọi không có đối số

In lại Tác giả: Walker 123 更新时间:2023-11-28 10:46:54 25 4
mua khóa gpt4 Nike

我正在创建一个简单的登录注册应用程序。但是我遇到了错误,我不知道如何解决,请帮忙!这是我的代码:

//
// ViewController.swift
// CHLogbook-Application
//
// Created by Timothy Dillan on 06/01/18.
// Copyright © 2018 TPINC. All rights reserved.
//

import UIKit
import FirebaseAuth
import Firebase

class ViewController: UIViewController {

@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!


override func viewDidLoad() {
super.viewDidLoad()

}

@IBAction func createAccountTapped(_ sender: Any) {
if let email = emailTextField.text, let password = passwordTextField.text {
Auth.auth().createUser(withEmail: email, password: password, completion: { user, error in
if let firebaseError = error {
print(firebaseError.localizedDescription)
return
}
self.presentLoggedInScreen()
})
}
}
@IBAction func loginTapped(_ sender: Any) {
if let email = emailTextField.text, let password = passwordTextField.text {
Auth.auth().signIn(withEmail: email, password: password, completion: { (user, error) in
if let firebaseError = error {
print(firebaseError.localizedDescription)
return
}
self.presentLoggedInScreen()
})
}
}
func presentLoggedInScreen() {
let storyboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let loggedInVC:LoggedInVC = storyboard.instantiateInitialViewController(withIdentifier:"LoggedInVC") as! LoggedInVC
self.present(loggedInVC, animated: true, completion: nil)
}
}

错误在 withIdentifier 部分的这一行中,当我想运行它时,它总是说“Argument passed to call that takes no arguments”:

let loggedInVC:LoggedInVC = storyboard.instantiateInitialViewController(withIdentifier:"LoggedInVC") as! LoggedInVC

câu trả lời hay nhất

instantiateInitialViewController 没有参数,它只是初始化 Storyboard的第一个 View Controller 。您正在寻找 instantiateViewController.

let loggedInVC = storyboard.instantiateViewController(withIdentifier:"LoggedInVC") as! LoggedInVC

关于ios - 错误 : Argument passed to call that takes no arguments,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48129860/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress