有人知道如何让用户在 Swift Xcode 6.4 中使用 parse 进行注册吗? 我已经搜索了所有内容,但找不到一个有效的。
我尝试了这段代码,但没有成功。
它说:
Use of unresolved identifier PFUser
import UIKit
class SignupViewController: UIViewController {
@IBOutlet var usernameTextField: UITextField!
@IBOutlet var passwordTextField: UITextField!
@IBOutlet var emailTextField: UITextField!
@IBOutlet var messageLabel: UILabel!
@IBAction func loginVerifyButton(sender: AnyObject) {
var usrEntered = usernameTextField.text
var pwdEntered = passwordTextField.text
var emlEntered = emailTextField.text
if usrEntered != "" && pwdEntered != "" && emlEntered != "" {
// If not empty then yay, do something
} else {
WrongInfo()
}
}
func userSignUp() {
var user = PFUser()
user.username = usrEntered
user.password = pwdEntered
user.email = emlEntered
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
func WrongInfo(){
var WrongInfo:UIAlertView = UIAlertView(title: "ALL FEILDS REQUIRED", message: "Please use all feilds!", delegate: self, cancelButtonTitle: "ok")
}
}
最佳答案
您需要在 Appdelegate.swift 文件中导入 Parse !如果仍然遇到相同的错误,请在注册 View Controller 中导入 Parse
关于ios - 如何使用 Swift 将注册页面添加到我的 Parse 应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32144488/